Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Open file issues

by eserte (Deacon)
on Aug 18, 2004 at 09:55 UTC ( #383908=note: print w/ replies, xml ) Need Help??


in reply to Open file issues

All the files in your script share one filehandle, FILE. You have two options to solve this problem: use Symbol::gensym() to create unique filehandles, or use lexicals instead of bareword filehandles. The latter option requires you to have a new perl (5.6 or 5.8, I can't remember). The code would look like this:

my $fh; open($fh, "...") or die ...; return $fh;


Comment on Re: Open file issues
Select or Download Code
Re^2: Open file issues
by Fletch (Chancellor) on Aug 18, 2004 at 13:03 UTC

    You could also use IO::File which should work in even older perls.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2015-07-07 12:25 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 (88 votes), past polls