Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: lexical vs. local file handles

by Anonymous Monk
on Apr 18, 2020 at 21:37 UTC ( #11115748=note: print w/replies, xml ) Need Help??

in reply to lexical vs. local file handles

I've seen many Perl programmers advocating the usage of lexical scalars instead. Though there are good reasons for this, it has a drawback. Filehandles in Perl are special on a syntactical level. The compiler is capable of catching errors like this: The question remains: Do I miss something here? Do you see any pitfalls using this approach?


Have you heard the expression "pennywise"?

Favoring global filehandles in order to let perl catch the unicorn of typos, is "pennywise but pound foolish"

Why wouldn't you favor  STDOUT->print(1) or  $fh->print(1) instead?

GLOB(0x3f9abc) ought to be something you would easily notice as an error when deeloping your program

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2020-11-30 12:30 GMT
Find Nodes?
    Voting Booth?

    No recent polls found