in reply to Opening a file at a designated offset based on closing of the file

I believe you are looking for tell() and seek(). You would use tell() to get your position before you close the file, then use seek() to move to that same position before you start reading again.

Some bits-o-code from some bits-o-dreck-o-mine:

# Close the log file and save information for next log check. # Remember where (and when) we stopped reading for next time. $FTPTrkLastReadPos = tell(FTPLOG); $FTPTrkLastReadTime = time; close(FTPLOG);
and
# Get current characteristics of the log file my ($filesize,$modified,$created) = (stat(_))[7,9,10]; $FTPTrkLastReadPos = 0 if( $filesize < $FTPTrkLastReadPos ); # Process any and all new entries seek FTPLOG, $FTPTrkLastReadPos, 0;
Why do I check the filesize of the file before reading it?   Because someone may have deleted, reduced or truncated the file since I last read it.   In my case I am able to handle this gracefully because I can look at the timestamps in each log entry and see if I have processed them before.