[Columbia-pm] sorting

Gunz, Alexander J. gunza at missouri.edu
Thu Nov 16 19:03:43 PST 2006


Perl sorts numbers like this:

1
10
135,152
2
20,000,000
21
3

How do you make it sort them like this:

1
2
3
10
21
135,152
20,000,000

???
The only way I can do it now is to work out how many decimals I'm likely
to go to, and insert leading zeros ("001, 002", etc). Problematically,
Perl sometimes interprets this as octal numbers and sorts them in even
crazier ways. Can someone make my life easier?

Thanks
Alex


More information about the Columbia-pm mailing list