Anyways, salva++ for simplifying things :-)The Orcish Maneuver -- example
keys my %or_cache = @in; @out = sort { ($or_cache{$a} ||= KEY($a)) cmp ($or_cache{$b} ||= KEY($b)) } @in;The first part of the sortsub sees if the sortkey for $a is cached.
If not, it extracts the value of the sortkey from the operand and caches it.
The sortkey for $a is then compared to the sortkey for $b.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re^3: Sorting Index of An Array
by shmem
in thread Sorting Index of An Array
by neversaint
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |