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


in reply to read a file twice...

besides the two approaches given above, you could give Tie::File by Dominus a try. It would allow you to manipulate a text file as a perl array (each file record, line per default, corresponding to an element of the array) without loading the whole file into memory, so it is specially useful for large files. Also useful when modifying files...

hope this helps,