in reply to Safe Counter Follow Up
in thread Safe Counter

Take a look at the perlopentut man page (perlopentut on CPAN if perldoc is still down). Look in the section 'File Locking', there is example code for what you are trying to do.