Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: How do I sort a CSV file on multiple columns?

by AnomalousMonk (Archbishop)
on Dec 09, 2009 at 20:18 UTC ( [id://812031]=note: print w/replies, xml ) Need Help??


in reply to Re: How do I sort a CSV file on multiple columns?
in thread How do I sort a CSV file on multiple columns?

The  <=> numeric comparison automatically numerifys to a decimal number before the comparison:

>perl -wMstrict -le "my @l = qw(10 010 0010 8 08 008 9 09 009 1 01 001); @l = sort { $a <=> $b } @l; print qq{@l}; " 1 01 001 8 08 008 9 09 009 10 010 0010

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 12:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found