Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: The difference between my and local

by shmem (Canon)
on Oct 17, 2006 at 11:40 UTC ( #578738=note: print w/ replies, xml ) Need Help??


in reply to Re^3: The difference between my and local
in thread The difference between my and local

Lexical (my) variables cannot be localized, as the error tells you. Use my for that :-P

use strict; my $tt = 3.14159; { my $tt = 3; print "In block, \$tt = $tt\n"; print "In block, \$::tt = $::tt\n"; } print "Outside block, \$tt = $tt\n"; print "Outside block, \$::tt = $::tt\n";
local is for globals. But there's a way to get lexical globs, I wonder whether these can be localized... ;-)
_($_=" "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}


Comment on Re^4: The difference between my and local
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (18)
As of 2015-07-01 15:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (6 votes), past polls