perldoc Tie::File"Tie::File" represents a regular text file as a Perl array ... The file is not loaded into memory, so this will work even for gigantic files.