OK - gotta add it, because I can. {grin}
For a complete description of the steps, see my column on sorting.
my @output = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [$_, expensive_func($_)] } @input;
Back to
Cool Uses for Perl
For a complete description of the steps, see my column on sorting.
my @output = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [$_, expensive_func($_)] } @input;