{ my $foo = 'foo'; sub xyzzy { print "$foo\n"; } } my $foo = 'bar'; xyzzy(); # Prints the 'foo' that stayed shared.