in reply to Answer: how to populate array with lines from text file?

Of all ways to put a file's lines in an array, I'm afraid that is one of the most inefficient. Moving data from INSIDE a do { } block to OUTSIDE a do { } block requires copying it, so you're making a list and checking it twice, so to speak.

If I REALLY needed to put a file into an array (why, I do not know), using the above trick, I'd do:
my @lines; { local @ARGV = $file; @lines = <> }
But why should the file be in an array? Ick.

japhy -- Perl and Regex Hacker