$ perl -E 'defined(%h)' 2>&1 | splain defined(%hash) is deprecated at -e line 1 (#1) (D deprecated) defined() is not usually useful on hashes because it checks for an undefined scalar value. If you want to see if the hash is empty, just use if (%hash) { # not empty } for example. (Maybe you should just omit the defined()?)