use strict; use warnings; my %hash = ( 'name'=>'hisham', 'keyword'=>undef, 'place'=>'the Monastery' ); my $key_count = keys %hash; my $value_count = grep {defined} values %hash; print $key_count,"\n"; print $value_count,"\n";