Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: my() and our()

by emazep (Priest)
on Aug 09, 2005 at 16:28 UTC ( #482293=note: print w/ replies, xml ) Need Help??


in reply to my() and our()

A simple package declaration addition to your code will produce the result you expect:

our $var = 1; { package Inner; # new package declaration our $var = 2; print $var, "\n"; # prints 2 } print $var, "\n"; # prints 1, # cause we're back in the "outer" package # (main, by default)
This is just a little example that may help to clarify what the other eminent monks have already explained in this thread.

Ciao,
Emanuele.


Comment on Re: my() and our()
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (12)
As of 2015-07-28 23:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls