Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: tripping over filehandle / subroutine usage

by LanX (Canon)
on Dec 21, 2012 at 21:43 UTC ( #1009962=note: print w/ replies, xml ) Need Help??


in reply to tripping over filehandle / subroutine usage

just a guess:

if your FH is at EOF after the first subroutine you should reset the position to start using seek before expecting to read again in another sub.

UPDATE:

ok, now that you updated code it seems like my guess was right:

my @rows = (<$input_handle>);

exhausts your filehandle.

BTW you should consider working with something like

while ( my $line = <$input_handle>) {
to read line by line, when working with large files, because otherwise you're consuming lots of RAM.

Cheers Rolf


Comment on Re: tripping over filehandle / subroutine usage
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-07-23 02:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (131 votes), past polls