#!/usr/bin/perl -w use strict; { package Foo; $Foo::DCALLS = 0; sub new { bless {}, shift; } sub DESTROY { $Foo::DCALLS++; warn "DESTROY CALLED"; } } { my $foo = Foo->new; sub { print "FOO: $foo\n"; sub { print "FOO: $foo\n"; # comment this out and the destructor is called }; }; } END { print "DCALLS: $Foo::DCALLS\n"; }