bar() is only visible inside foo() and it does not leak
(as opposed to: my $bar = sub {}; $bar->(); but that is not tested -- see "http://www.perlmonks.org/index.pl?node=833941" for explanation)
sub foo {
print "in foo\n";
local *bar = sub {
print "in bar\n";
};
bar();
}
foo();
No comments:
Post a Comment