my $filename = '/path/to/file'; # Increment the counter (atomically, so no locking required) open(FILE, ">> $filename") or warn "Missed a count"; print FILE '.' # Ouput one (arbitrary) byte close FILE; # What is the counter set to? my $countval = -s $filename || 0;