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

Re: Closing and re-opening the DATA Filehandle

by Adam (Vicar)
on Apr 05, 2001 at 02:22 UTC ( #69923=note: print w/ replies, xml ) Need Help??


in reply to Closing and re-opening the DATA Filehandle

HA! I figured it out!

This works, and no filehandles in the error messages:

my @Table; sub LoadTable { local( $/, $. ); my $position = tell( DATA ); @Table = map {chomp; hex} split ' ', <DATA>; seek DATA, $position, 0; # Reset the filehandle, rather then closi +ng it. # Never close DATA. }
But if I take $. out of the local line, then the filehandle shows up in the error messages. Thanks all!


Comment on Re: Closing and re-opening the DATA Filehandle
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2015-07-04 11:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (59 votes), past polls