http://www.perlmonks.org?node_id=179085


in reply to File Locking

seek(MYFILE, 0, 0); truncate(MYFILE, 0);
These bring us to the end of the file, and then sets the length to zero.

The camelbook on seek tells me that seek(MYFILE, 0, 0); brings the file pointer to the beginning of a file.