The other posters have good suggestions about updating a data file. But if you want to learn about
seek, read the documentation. The second argument is the offset, and the third argument tells what to measure the offset against. The possibilities are SEEK_SET (0), SEEK_CUR (1), and SEEK_END (2). You don't really need to seek to the beginning because that is where the filehandle starts.
The end of the file is: seek($fh, 0, 2);
The beginning is: seek($fh, 0, 0);
The 10th byte from the beginning is: seek($fh, 10, 0);
The 10th byte before the end is: seek($fh, -10, 2)