However destructors run at program termination often find that data they expected to have still around is not there. Such as data inside of the object you are destroying
in reply to Re: Beware of global variables, for they may prevent your destruction.
in thread Beware of global variables, for they may prevent your destruction.
Therefore it is safer to deallocate globals in END blocks. That way you can control what is there. But be careful not to do anything that messes up $!, else exit may not work as expected.