Not a Member Yet,
Click here to Register

ID: 95
Viewed: 3668
Added: Mar 07, 2002
Version:
Snippet uploaded by: snippet
Written By: snippet
Demo: Sorry, no demo



User Rated at: 5 Stars5 Stars5 Stars5 Stars5 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

This little peice of code will write to a file that you tell it.

the contents depend on what you put in the PRINT line. this will also lock the file so nobody can write to it at the same time you are. then it will unlock it and close it.

very good for a flat file database for guestbooks and counters.

<!---Head--->
none

<!---Body--->


 #!usr/bin/perl
$Datafile = "data.txt";

open(THEFILE,">>$Datafile") || die "Can't open $Datafile: !$n";
flock(THEFILE, 2); #Lock

print THEFILE "whatever you put here will be written to the filen";
flock(THEFILE, 8); #Free
close(THEFILE);


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2024 snippetlibrary.com All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!