defined-or cache, needs defined-or (dor) operator introduced in 5.10my @sorted = sort { ( $times{$a} //= expensive_call($a) ) <=> ( $times{$b} //= expensive_call($b) ) } @old_array;
See also Resorting to Sorting, Sorting problem with Orcish Manuever
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: D'Orcish Maneuver
by Your Mother (Archbishop) on Apr 27, 2011 at 21:21 UTC | |
|
Re: D'Orcish Maneuver
by ikegami (Patriarch) on Apr 27, 2011 at 21:52 UTC | |
by JavaFan (Canon) on Apr 28, 2011 at 09:47 UTC | |
by ikegami (Patriarch) on May 04, 2011 at 19:10 UTC | |
|
Re: D'Orcish Maneuver
by John M. Dlugosz (Monsignor) on Apr 30, 2011 at 10:28 UTC | |
|
Re: D'Orcish Maneuver
by locked_user sundialsvc4 (Abbot) on Apr 29, 2011 at 02:30 UTC | |
by Anonymous Monk on Apr 29, 2011 at 02:41 UTC |