Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: Is it possible to create a sub exclusive to a sub?

by Aristotle (Chancellor)
on Sep 19, 2004 at 10:35 UTC ( [id://392155]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Is it possible to create a sub exclusive to a sub?
in thread Is it possible to create a sub exclusive to a sub?

You use %main::test. That that's the same as *main::test{HASH} and *main::test{CODE} happens to be defined doesn't make it any less of a global variable. At least if you're going to go that route, do it directly

use vars qw( %test ); # ... $test{localsub}->();

so that strict can catch your typos. (Though it still won't catch $test{lcoalsub}, as opposed to a lexical mistyped as $lcoalsub.) The way you wrote it deprives you of protection wholly.

Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-03-29 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found