package LL::Node; { my $allocated=0 sub new { $allocated++; bless {},$_[0]; } sub DESTROY { $allocated--; } sub END { warn "There were $allocated nodes that have not been properly freed dusing destruction.\n" if $allocated; } } # other stuff #### sub DESTROY { $allocated--; $_[0]->{next}=undef; $_[0]->{prev}=undef; }