Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2015-11-26 11:44 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (697 votes), past polls