in reply to [SOLVED]How to sort the referencese
You can't do the same thing as in C. But you can create a second array with the sorted indices:
my @A = qw(A C D D C D A G F); my @sorted = sort { $A[$a] cmp $A[$b] } (0 .. $#A); print @sorted,"\n"; print @A[$sorted[1] .. $#A],"\n"; print @A[$sorted[4] .. $#A],"\n"; # prints 061423587 AGF DDCDAGF
|
|---|