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


in reply to reading multiple files into an array
in thread Unix Perl and Html

Better would be:
my @files= qw| /path/to/file1 /path/to/file2 /path/to/file3 |; my @allfiles; for my $filename(@files){ open FILE, $filename || die "Cannot open $filename for reading: $!\n"; push @allfiles, $_ while (<FILE>); close FILE; } # Or (and even more Perlish) ... my @files= qw| /path/to/file1 /path/to/file2 /path/to/file3 |; my @allfiles; for my $filename(@files){ open FILE, $filename || die "Cannot open $filename for reading: $!\n"; push @allfiles, <FILE>; close FILE; }

------
/me wants to be the brightest bulb in the chandelier!

Vote paco for President!