in reply to Sorting an array of lines
#!/apps/bin/perl -w my (@array, @sorted) =(); while (<>) { chomp; push (@array, $_); } @sorted = map {$_->[0]} sort {$a->[1] <=> $b->[1]} map { my ($sortvalue) = /(\d+)$/; [$_,$sortvalue]; } @array; print "@sorted\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Sorting an array of lines
by Juerd (Abbot) on Feb 08, 2002 at 22:42 UTC |