my %hash = getHash(); if (! defined(%hash)) { print "undef\n"; } else { print "not undef\n"; }