for my $key (sort { $HASH{$a}{COUNT} <=> $HASH{$b}{COUNT} } keys %HASH) { my $value = $HASH{$key}; ... }