![]() |
|
Just another Perl shrine | |
PerlMonks |
Re: Sorting a File which contains numbersby Hofmator (Curate) |
on Oct 30, 2006 at 14:11 UTC ( #581298=note: print w/replies, xml ) | Need Help?? |
Watch out: sort sorts normally "in standard string comparison order" which is NOT numerically. In order to sort numerically, you have to use an explicit sort routine.
With your expamle input file, this won't make a difference though, as it sorts the same numerically AND alphabetically. -- Hofmator Code written by Hofmator and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
In Section
Seekers of Perl Wisdom
|
|