sub baz { my $foo=shift; sub bar { print $foo; } } baz("abc"); bar; baz("123"); bar;