my $key_total = keys %hash; #### my $defined_count = grep { defined } values %hash;