Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: file open with variables

by eyepopslikeamosquito (Archbishop)
on Sep 28, 2022 at 07:49 UTC ( [id://11147145]=note: print w/replies, xml ) Need Help??


in reply to Re: file open with variables
in thread file open with variables

The usual rant about using lexical filehandles will come shortly

So as not to disappoint the choroba: always use lexical filehandles!!! (and the 3-argument form of open).

Further to kcott's exemplary sample code, which uses the recommended 3-argument form of open with a lexical filehandle, note that lexical filehandles are automatically closed at end of scope (used here to illustrate how Perl garbage collection differs from Java).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-25 13:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found