while((my $key,my $value) = each %hash) { print "$key - $value\n"; $count++ if $value==keys(%hash); }