in reply to How to sort in perl on the basis of one field.
Hi Aukur kuls,
If I may add my voice to that of others, that what you seek can be done in a single "breath" with what is called popularly known as Schwartzian Transform.
Using a modified version of what you posted one can do:
use warnings; use strict; print map { $_->[0] } sort { $b->[1] <=> $a->[1] } map { [ $_, ( split /[,\s\D]+/, $_ )[2] ] } <DATA>; __DATA__ field15,field78,filed0 field90,field12,filed23 field3,field55,filed67
|
|---|