tie my $x, 'Tie'; my $f = sub { $x }; { my $scope = tempSet(\$x, 2); print $f->(), "\n"; # => 2 is still tied } $x = 1; print $f->(), "\n"; # => 2 is still tied