sub opennumfile{ open(COUNT,$count) or die ("Can't open $count: $!"); flock(COUNT, 1); #shared lock for reading $c = ; close(COUNT) or die ("Can't close $count: $!"); if ($count =~ /\n$/) {chomp($c);} if (!defined($y = param('update'))){ $y = "Yes"; } if (uc($y) eq "YES"){ $c++; open(COUNTER,">$count") or die ("Can't open $count: $!"); flock(COUNTER, 2); #exclusive lock for writing print COUNTER "$c\n$somethingfile\n"; # path to the calling web page close(COUNTER) or die ("Can't close $count: $!"); } $c = sprintf("%d", $c); # essential line but only if $y ne "YES" $nim = $r = length($c); while ($r > 0) { $char[$r] = chop($c); $r--; } }