... sub new { # whatever new actually does {our $_total_constructed; $_total_constructed++} # return object } ... sub DESTROY { our $_total_destroyed; $_total_destroyed++ }