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


in reply to Out of memory problem when copying contents of file into array

Another alternative:
#!/usr/bin/perl -w use strict; use IO::All; my @reversed_io = io("file.txt")->backwards->getlines; my @lines; push @lines, $reversed_io[$_] for ( 0 .. 100 );
  • Comment on Re: Out of memory problem when copying contents of file into array
  • Download Code