About a year ago, Simon Cozens reported a bug to the effect that { my $x = bless sub { }, 'X'; } sub X::DESTROY { print "DESTROYED\n" } Doesn't call the destructor. Having looked at it, the reason is that the anon sub isn't a closure (ie doesn't refer to any outer lexicals. Thus, the CV is shared rather than cloned, so its refcnt is >1 when $x is freed. Turning it into a closure makes it work: my $y; { my $x = bless sub { $y }, 'X'; } sub X::DESTROY { print "DESTROYED\n" } Simon mentions that "either the documentation or the code are wrong". Since it would be inefficient to fix, and since closureless anon subs are more common that blessed coderefs (I would speculate), I think it should be documented as a misfeature. Dave. -- In England there is a special word which means the last sunshine of the summer. That word is "spring".Thread Next