Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 ( [id://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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-19 12:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found