snippet library logo
Turnkey Websites from Built2go.com
in category
Perl / File Manipulation / Writing to a File
Snippet details
ID: 95
Viewed: 1524
Added: 2002-03-07
Version:

User Rated at: 5 Stars
Rate This:
Snippets in this catagory         
Show Printable Version
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.

General Details
Snippet uploaded by: snippet
Email : webmaster@snippetlibrary.com
Snippet By: snippet

<!---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 Reviews to show


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


Subject:

Reviewed By:

Write a review:





Terms of Conditions
Powered By
Avian Hosting
© 2005 snippetlibrary.com All Rights Reserved.