Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: How do I read the files in @ARGV one by one

by Masem (Monsignor)
on Mar 19, 2001 at 20:54 UTC ( #65455=note: print w/ replies, xml ) Need Help??


in reply to How do I read the files in @ARGV one by one

Right now, you have no file handles to those data files to speak of, so it's odd how you are getting even that data. The way you want to do it is:

foreach my $file (@ARGV) { if ( -e $file ) { # double check existence push @data, $file; open FILE , '<'.$file or die $!; while( <FILE> ) { push @data, $_; } close FILE; } }

Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain


Comment on Re: How do I read the files in @ARGV one by one
Download Code
Re: Re: How do I read the files in @ARGV one by one
by isotope (Chaplain) on Mar 19, 2001 at 23:46 UTC
    It's not odd because he's using the <> operator, which returns all the data from all the files listed in @ARGV, all in one pass, line by line. It doesn't let you break it up by file, though.

    --isotope
    http://www.skylab.org/~isotope/

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2014-08-23 04:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (172 votes), past polls