- or download this
my @sorted=do{
my $n;
my %stuff=map { func($_) . ':' . $n++ => $_ } @unsrt;
@stuff{sort keys %stuff};
};
- or download this
my @sorted=do{
my @keys=map func($unsrt[$_]) . ":$_", 0 .. $#unsrt;
@unsrt[ map +(split /:/)[-1], sort @keys ];
};
- or download this
my @sorted=@unsrt[ map +(split /:/)[-1],
sort map func($unsrt[$_]) . ":$_", 0 .. $#unsrt ];
- or download this
my @sorted=map $unsrt[ (split /:/)[-1] ],
sort map func($unsrt[$_]) . ":$_", 0 .. $#unsrt;