in reply to Skipping to file end

johngg has answered your "meta-question" (which seems to be "how do I stop processing a file when I find what I'm looking for"), but if you really want to move the file read pointer to the beginning or end of a file then you can use the seek function.

use Fcntl qw(:seek)# load symbolic constants seek FILEHANDLE, 0, SEEK_SET; # start of file seek FILEHANDLE, 0, SEEK_END; # end of file