http://www.perlmonks.org?node_id=966768


in reply to my and local variable significance in a particular case

$x = "x"; $y = "y"; sub uc_call { my $x = uc $x; local $y = uc $y; shift->(); } my $code = sub { print "$x $y\n" }; uc_call($code);

The above prints lower-case "x" but upper-case "Y", which illustrates that even without strictures, there's a difference between local and my.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'