Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: my() and our()

by emazep (Priest)
on Aug 09, 2005 at 16:28 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://482293]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-24 16:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found