http://qs1969.pair.com?node_id=578738


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}