in reply to Sort the array
First, code tags are <code> and </code> not [code] and [/code].
For a numerical sort you want to use a numerical comparison operator, for example:
my @theList = ( 205, 4, 100, 1, 2, 2000, 6, 93, 2, 65 ); my @theSortedList = sort { $a <=> $b } @theList; print join( ',', @theSortedList ), "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Sort the array
by shekarkcb (Beadle) on Nov 10, 2008 at 11:37 UTC | |
by jwkrahn (Abbot) on Nov 10, 2008 at 11:53 UTC |