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


in reply to How to read a file twice

Have a look at seek to reset the filehandle's position.