more useful options | |
PerlMonks |
Re^2: file open with variablesby eyepopslikeamosquito (Archbishop) |
on Sep 28, 2022 at 07:49 UTC ( [id://11147145]=note: print w/replies, xml ) | Need Help?? |
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).
In Section
Seekers of Perl Wisdom
|
|