Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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?
[Discipulus]: how I can tell in which perl version was included List::Util 1.29 ?
[Discipulus]: to specify use 5.0.x to be sure to have pairmap from the module..
[Corion]: Discipulus: I think Module::Corelist ( or corelist ) can tell you that
[Corion]: Meh - Module::CoreList
[choroba]: Just use List::Util 1.29
[choroba]: Be kind to people using old Perl with newer version of the module
[Corion]: But why not simply specify 'List::Util' => 1.29 in your prerequisites? People might install a more recent version of the module into their Perl
[Corion]: (what choroba said)

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2017-05-25 09:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?