in reply to substr sort ??
Actually you can just lose the substr. It isn't gaining you anything. Perl will convert the strings to numbers and just Do The Right Thing.
@values = sort { $a <=> $b } @values;
Update: broquaint reminds me that this will generate warnings under "use warnings". It will still give the right answer tho' :)
--"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re2: substr sort ??
by dragonchild (Archbishop) on Aug 22, 2003 at 12:56 UTC |