Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Is there a problem with using barewords as filehandles ?

by LanX (Saint)
on Jul 01, 2020 at 15:23 UTC ( [id://11118762]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Is there a problem with using barewords as filehandles ?
in thread Is there a problem with using barewords as filehandles ?

> because whoever wrote it wasn't thinking about scope,

FWIW you can localize a FH inside the function's scope, but this implies some glob syntax IIRC.

I think local *FH but ...

  • I'd need to look it up
  • it'll localize all other vars with the same symbol, like $FH too
  • it's a dynamic runtime scope not a lexical, ie don't call another sub from inside which doesn't localize the same symbol before using it

Not that beginner friendly

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Log In?
Username:
Password:

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

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

    No recent polls found