#map BLOCK, LIST #or something like @revwords=map{ @letters=split(//); @revletters=reverse(@letters); join(' ',@revletters); } @words; #or #map EXPR, LIST @asciival=map(ord,@letters); #### @origarray=('0 1 2','0 0 0','-3 -2 -1','10 11 12'); @sortedarray= map{$_->[0]} sort{$a->[1] <=> $b->[1]} map{ my @cols=split(/\s+/); my $sum=$cols[0]+$cols[1]+$cols[2]; [$_,$sum]; } @origarray; foreach(@sortedarray){ print "$_\n"; } #### @sortedarray= map{$_->[0]} # only use one of these sort lines sort{$a->[1] <=> $b->[1]} # this one for numerical sorting sort{$a->[1] cmp $b->[1]} # this one for textual sorting map{ #calculate $computedsortval [$_,$computedsortval]; } @origarray;