# will print "no keys" if all values are undef.. print "no keys\n" unless( values(%hash) != NULL ); # to resest a hash.. %hash = (); # or if you are paranoid undef(%hash) && %hash = ();