in reply to Re^3: Sorting a hash of arrays based on a particular array element.
in thread Sorting a hash of arrays based on a particular array element.
The algorithm used is similar to...
but being implemented in C (specially, the comparing callbacks) it doesn't require the nasty hacks of the GRT to do the sort part efficiently.sub sortkey { my ($func, @v); my @keys = map { &$func } @v; my @ix = sort { $keys[$a] cmp $keys[$b] } 0..$#keys; return @v[@ix] }
|
|---|