in reply to Classic Sort Algorithm
use Sort::Key::Multi qw(n2_keysort); my @data = <>; my @sorted = n2_keysort { (split)[1, 0] } @data; print @sorted;
Update: Perlbotics has pointed me out that the OP probably wants the data to be sorted by the second column in descending order and then by the first column in ascending order, so...
use Sort::Key::Multi qw(rnn_keysort); my @data = <>; my @sorted = rnn_keysort { (split)[1, 0] } @data; print @sorted;
Update 2: s/sortkey/keysort/g;
|
|---|