Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Local(*FILE);

by dws (Chancellor)
on Jan 13, 2002 at 01:49 UTC ( [id://138333]=note: print w/replies, xml ) Need Help??


in reply to Local(*FILE);

Before the advent of IO::File, which provides an object-oriented API for accessing files, there was no alternative to using file handles. The problem with file handles come when writing (or using) modules. If a routine in a module needs to open a file, and uses FILE for the file handle, the only way to avoid smashing some other FILE is to localize the file handle using the   local *FILE; idiom. This guarantees that any other variables named FILE will be restored at the end of the routine that does the localizing.

If you're writing a simple script, there's little reason to do this yourself. If you're writing a module, the better thing to do now is use IO::File for file access.

Log In?
Username:
Password:

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

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

    No recent polls found