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


in reply to Read from a file one line at a time?

Assuming you've already opened the filehandle FILE you can read all the lines into a list with

my @lines=<File>;

or read one line at a time with

while (<FILE>){ my $line=$_; }

there are more compact ways to do the latter, as well.