Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://482293]
help
Chatterbox?
LanX googling for ones own childish humour has advantages ... see Pray for Paris
[LanX]: Moon not Mars

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2017-03-27 15:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.