in reply to sort array
Another option (Schwartzian transform):
map{print "$_->[0]\n"} sort {$a->[1] cmp $b->[1]} map{[$_, (split)[2]]} @lines;
Sorts on third word from the left. Replace [2] with [-3] after (split) to sort on third word from the right.
Hope this helps!
|
|---|