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 ...