use PadWalker qw(peek_my); my $a=10; sub { my $a=11; my $my = peek_my(1); # one level up print ${$my->{'$a'}}; # 10 print $a; # 11 }->();