package whatever; my %customDestroy; sub new { my( $class, $flag, ... ) = @_; my $self = {}; ... $customDestroy{ $self } = 1 if $flag; return bless $self, $slass; } ... sub DESTROY { my $self = shift; if( $customDestroy{ $self } ) { ## special behaviour } else { ## normal behaviour } }