Keep It Simple, Stupid | |
PerlMonks |
Re: Use of a global scalarby shmem (Chancellor) |
on Sep 02, 2006 at 23:58 UTC ( [id://570898]=note: print w/replies, xml ) | Need Help?? |
This is a fine moment for
;-) See our. Variables declared with our aren't global. The only global variables in perl are the 'special' variables, e.g. $_. But with these, "global" means only that the symbol is available everywhere, without any previous declaration - but the actual value accessible through that symbol is subject to localizing and aliasing. The documentation for our stresses within the current scope - and a block boundary is a scoping boundary. Say use vars qw($text) to have a package global, or use ${^_text} to have a really real global (the symbol is bound to the package main, though). --shmem _($_=" "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
|
|