Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Using an array of file handles

by hdb (Monsignor)
on Apr 22, 2016 at 11:32 UTC ( [id://1161205]=note: print w/replies, xml ) Need Help??


in reply to Using an array of file handles

Easy workaround:

for my $handle (@in_fh) { while (<$handle> ) { print ; } }

You also have an "off-by-one" error: $i <= $count which you would have spotted by using strict and warnings.

Replies are listed 'Best First'.
Re^2: Using an array of file handles
by Laurent_R (Canon) on Apr 22, 2016 at 12:34 UTC
    Thank you hdb. Yes, sure, but finding a workaround was not really my problem (I actually presented one in my original post), my problem was that I was convinced that it was possible to read lines directly from something like <{$a[$c]}>, and it turns out that this was wrong.

    As for the off-by-one error, you're correct, but it's a mistake I did when trying to simplify the code for the post, I did not have the error in my slightly more complicated original code. Yes, I am using strict and warnings for all my programs (except possibly very simple one-liners).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 22:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found