in reply to How can we read each line from a file onto an array?

my @lines= do { local(*ARGV); @ARGV="filename.txt"; <> }; is one way to avoid having to open the file explicitly, check for errors, and report them.