Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Sorting a File which contains numbers

by Hofmator (Curate)
on Oct 30, 2006 at 14:11 UTC ( #581298=note: print w/ replies, xml ) Need Help??


in reply to Sorting a File which contains numbers

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.


Comment on Re: Sorting a File which contains numbers

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://581298]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2014-07-26 16:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (178 votes), past polls