Thread: Perl code
View Single Post
Old 08-24-2002, 06:41 AM  
FuqALot
Confirmed User
 
Join Date: Dec 2001
Location: Malibu
Posts: 3,817
Yo,

$file = "x.txt";
open(logfile,"+<".$file);
flock logfile, 2;
@logdata = <logfile>;
seek logfile, 0, 0;
print logfile $newline."\n";
print logfile @logdata;
truncate logfile, (tell logfile);
close(logfile);

is the way. Where $newline is the entry, and $file the logfile.
FuqALot is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote