Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Opening multiple files

by BrentDax (Hermit)
on May 30, 2006 at 08:21 UTC ( #552431=note: print w/replies, xml ) Need Help??


in reply to Opening multiple files

It's possible, but it's a real hack, involving @ARGV and the magic <> construct. (I won't tell you how to do it because if you're not clever enough to find it with those hints, you're not clever enough to know not to use it.) You're really better off simply using a loop. The correct way to code that loop would probably be like this:

my @lines; foreach my $file(@files) { open(IN, "< $file") or die "Can't open $file: $!"; push @lines, <IN>; close IN; } # Now do whatever you want with @lines

Alternatively, remove all references to @lines and replace the push line with:

while(my $line = <IN>) { #Do whatever processing you want with $line }

Hope this helps,

=cut
--Brent Dax
There is no sig.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2022-01-20 10:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (56 votes). Check out past polls.

    Notices?