Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Use of a global scalar

by shmem (Chancellor)
on Sep 02, 2006 at 23:58 UTC ( #570898=note: print w/replies, xml ) Need Help??

in reply to Use of a global scalar

This is a fine moment for
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'


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).


_($_=" "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}

Replies are listed 'Best First'.
Re^2: Use of a global scalar
by Grey Fox (Chaplain) on Sep 03, 2006 at 05:22 UTC
    Cute, but if I read the manual I wouldn't learn such interesting uses of the perl command line. :-)

    -- Grey Fox
    Perl - Hours to learn lifetime to master.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://570898]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2022-11-28 07:34 GMT
Find Nodes?
    Voting Booth?