Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: numeric sort on substring

by moritz (Cardinal)
on Jan 06, 2011 at 16:58 UTC ( [id://880871]=note: print w/replies, xml ) Need Help??


in reply to numeric sort on substring

Maybe you want something like (split /,/, $a)[1] <=> (split /,/, $b)[1]

for comparison.

Replies are listed 'Best First'.
Re^2: numeric sort on substring
by Anonyrnous Monk (Hermit) on Jan 06, 2011 at 17:10 UTC

    As that would sort by the second column only, it would fail to yield the desired output in case the input was sorted differently.  For example, if all the rows with "2" in the first column came first in the input, the output would be

    2,64,1.4.5,1.4.6,44642850,44642850,0,25828,9548,40128,1488095,761904.6 +4 1,64,1.4.5,1.4.6,44642850,44642850,0,27348,10028,59188,1488095,761904. +64 2,128,1.4.5,1.4.6,25337850,25337850,0,27936,10796,28696,844595,864865. +28 1,128,1.4.5,1.4.6,25337850,25337850,0,19236,10276,28196,844595,864865. +28 ...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 15:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found