my %hash = ( foo => 1, bar => 1, baz => 1, one => undef, two => undef, three => undef, ); print "defined - ", scalar(grep defined, values %hash), $/; print "not defined - ", scalar(grep !defined, values %hash), $/; __output__ defined - 3 not defined - 3