in reply to sort performance
You could avoid repeated double-lookups with a Schwartzian
sort:
(Read it bottom to top and it will make more sense.)my @sorted_keys = map {$_->[0]} sort {$a->[1] cmp $b->[1]} map {[$_, $hash{$_}{this}]} keys %hash;
This is more memory intensive, but doing the double lookup in the sort block means that it happens O(n * log(n)) times. Doing it in a map means it only happens n times. (Where n is the number of keys.)
In Section
Seekers of Perl Wisdom