%hash = (a=>1,b=>2); $count = 0; while(($key,$value) = each %hash) { $count++ if $value==keys(%hash); } print $count;