Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

--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}

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2022-09-30 10:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (126 votes). Check out past polls.

    Notices?