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.
|