The reason that defined(%hash) is deprecated is apparently that it returns some internal memory-allocation property of the hash, and that this property is true when the hash is undefined in the Perl sense of things (eg having been set to undef).
Just %h is a perfectly good test and returns false if %h has been set to undef or (undef) (which seems to be the same thing).
Furthermore, you can't undefine a hash or array by assigning undef to them:
- %h = undef results in %h having one key, '', mapped to undef (and also gives an 'odd number of hash elements' warning)
- @a = undef results in @a having one element, undef
The two correct ways to undefine an array or hash are: