{ my $subref; { my $foo = Foo->new; $subref = sub { # outer print "FOO: $foo\n"; }; } print "Outside!\n"; $subref->(); } #### Outside FOO: Foo=HASH(0x1a7eefc) DESTROY CALLED at xx line 15. #### { my $subref; { my $foo = Foo->new; $subref = sub { # outer print "FOO: $foo\n"; sub { # inner print "FOO: $foo\n"; }; }; } print "Outside\n"; $subref->(); }