Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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 chilling in the Monastery: (7)
As of 2014-12-27 00:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls