Another approach would be to use File::CounterFile.
In reply to Re: File I/O by rhesa in thread File I/O by Anonymous Monk