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

Re: lexical vs. local file handles

by Anonymous Monk
on Apr 18, 2020 at 21:37 UTC ( [id://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?

Hi,

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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-24 17:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found