http://qs321.pair.com?node_id=45869


in reply to How to populate array with lines from text file? (Moved from Q&A)

The main problem was $line. You should use $_ instead.

After a few other clean-ups, this works:

#!/usr/bin/perl -w use strict; my $file = "junk"; open (FH, "< $file") or die "Can't open $file for read: $!"; my @lines; while (<FH>) { push (@lines, $_); } close FH or die "Cannot close $file: $!"; print @lines; # see if it worked

Russ
Brainbench 'Most Valuable Professional' for Perl