sub foo { my $bar = sub { print "In bar\n"; }; $bar->(); }; #### sub foo { local *bar = sub { print "In bar\n"; }; bar(); };