my $x = 1; my $f = sub { $x }; { my_local $x = 2; print $f->(), "\n"; # => 2 } print $f->(), "\n"; # => 1