Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Dynamic File Handles

by ivancho (Hermit)
on Jun 07, 2005 at 02:08 UTC ( [id://464124]=note: print w/replies, xml ) Need Help??


in reply to Dynamic File Handles

Of course it's possible - it wouldn't be Perl otherwise..

You can even do funky stuff like: my @lines = map {<$_>} map {$fh[$_]} <>; though it's usually likely to shoot yourself in the foot in the process...

Note that on some OSs there is a noticeable limit on the maximum number of files open - but no, 3 won't trigger it.. more like 255..
it doesn't look like you want to write to some of those filehandles, but in case you do decide to, Perl will complain.. from
perldoc -f print Note that if you're storing FILEHANDLES in an array or other expression, you will have to use a block returning its value instead: print { $files[$i] } "stuff\n"; print { $OK ? STDOUT : STDERR } "stuff\n";

Log In?
Username:
Password:

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

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

    No recent polls found