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

Re (tilly) 1: How do I read the files in @ARGV one by one

by tilly (Archbishop)
on Mar 19, 2001 at 21:30 UTC ( #65471=note: print w/ replies, xml ) Need Help??


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

How do you distinguish filenames from contents of files in your data structure? A hash of arrays is cleaner.

The following snippet should work:

$data{$_} = [] foreach @ARGV; while (<>) { push @{$data{$ARGV}}, $_; }
The purpose of the first line is to make sure that files which are empty are included in your hash.


Comment on Re (tilly) 1: How do I read the files in @ARGV one by one
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (18)
As of 2015-07-28 17:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (258 votes), past polls