Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: reading multiple files into an array

by dragonchild (Archbishop)
on Aug 27, 2001 at 20:46 UTC ( #108168=note: print w/ replies, xml ) Need Help??


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!


Comment on Re: reading multiple files into an array
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://108168]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (12)
As of 2014-09-22 17:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls