arbitrary sorting...
Kari Chisholm
karic at lclark.edu
Thu Jul 18 18:00:01 CDT 2002
Tkil wrote:
> if you know that @foo is a subset of @bar (that is, there are no
> elements of @foo that are not also in @bar), then you can do:
>
> | my %bar_score = do
> | {
> | my $i = 0;
> | map { $_ => ++i } reverse @bar;
> | };
> | my @foo_by_bar = sort { $bar_score{$a} <=> $bar_score{$b} } @foo
>
Bingo. This is exactly what I wanted. I'll give it a shot. Thanks.
-kari.
TIMTOWTDI
More information about the Pdx-pm-list
mailing list