PDA

View Full Version : File write


firstdir
10-29-2000, 10:13 AM
Hi! All:
I am writing a counter by Perl. But I find if there is high load, my log file will crash. That means my log file's size will be zero.
Can you help me ?
Thanks!
Mike
###########################################
sub show_counter
#
{
open(COUNT,"+<$index_path/$showFile") | | die ;
flock (COUNT, 2) | | die "Cannot open file!";
$total = <COUNT>;
$total++;
seek(COUNT, 0, 0);
truncate(COUNT, 0);
print COUNT "$total";
close(COUNT);
}
###########################################