more useful options | |
PerlMonks |
Re: Mine or Oursby shmem (Chancellor) |
on Jan 21, 2007 at 00:03 UTC ( [id://595707]=note: print w/replies, xml ) | Need Help?? |
Apart from the links already provided, my/local, space/time might be helpful; our is different to both. Apart from our, you have also
use vars LIST. They are similar, but different. Both create package globals, but variables created with our are also
There you have the "does not necessarily create a variable" part - no variable is created in package bar. The variable $quux is shared between both packages - they would say "it's our $quux" if they could speak. Same applies for variables declared with our in different files. Having a file as
to be included in a main script
running the main script will output
The $me variable is shared between the two files. That's what our means ;-) --shmem update: corrected "file scoped" to "lexical scoped". See Re^4: Mine or Ours. _($_=" "x(1<<5)."?\n".q·/)Oo. G°\ / /\_¯/(q / ---------------------------- \__(m.====·.(_("always off the crowd"))."· ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In Section
Seekers of Perl Wisdom
|
|