Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 chilling in the Monastery: (8)
As of 2014-08-01 09:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (257 votes), past polls