in reply to Re^2: Sorting hashes with new value detection
in thread Sorting hashes with new value detection

Ah. Do you ever need to look up the value of word based on the word? (Ie. do you need the mapping that your simple hash provides?) If not, I’d simply keep this in the HoA as outlined by Roy Johnson and stick values inside using push @{ $words{ $score } }, $word;

Otherwise, I’d either keep both structures updated throughout the code (which means putting the push and hash assignment in a sub), or generate one of them out of the other on the fly and demand.

Makeshifts last the longest.