Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Here is my current data:sub RowSort { my($aa) = $a =~ /(\d+)\,(\d+)/; my($bb) = $b =~ /(\d+)\,(\d+)/; $aa <=> $bb; }
And here is my expected output:1,64,1.4.5,1.4.6,44642850,44642850,0,27348,10028,59188,1488095,761904. +64 1,128,1.4.5,1.4.6,25337850,25337850,0,19236,10276,28196,844595,864865. +28 1,256,1.4.5,1.4.6,13489200,13489200,0,17792,11372,17832,449640,920862. +72 1,512,1.4.5,1.4.6,6996270,6996270,0,18084,16744,19124,233209,955224.06 +4 1,1024,1.4.5,1.4.6,3557880,3557880,0,31528,20488,35188,118596,971538.4 +32 2,64,1.4.5,1.4.6,44642850,44642850,0,25828,9548,40128,1488095,761904.6 +4 2,128,1.4.5,1.4.6,25337850,25337850,0,27936,10796,28696,844595,864865. +28 2,256,1.4.5,1.4.6,13489200,13489200,0,12852,10692,13332,449640,920862. +72 2,512,1.4.5,1.4.6,6996270,6996270,0,17184,15904,18844,233209,955224.06 +4 2,1024,1.4.5,1.4.6,3557880,3557880,0,34068,17948,36628,118596,971538.4 +32
Any thougts?# result should be sorted: 1,64,1.4.5,1.4.6,44642850,44642850,0,27348,10028,59188,1488095,761904. +64 2,64,1.4.5,1.4.6,44642850,44642850,0,25828,9548,40128,1488095,761904.6 +4 1,128,1.4.5,1.4.6,25337850,25337850,0,19236,10276,28196,844595,864865. +28 2,128,1.4.5,1.4.6,25337850,25337850,0,27936,10796,28696,844595,864865. +28 1,256,1.4.5,1.4.6,13489200,13489200,0,17792,11372,17832,449640,920862. +72 2,256,1.4.5,1.4.6,13489200,13489200,0,12852,10692,13332,449640,920862. +72 1,512,1.4.5,1.4.6,6996270,6996270,0,18084,16744,19124,233209,955224.06 +4 2,512,1.4.5,1.4.6,6996270,6996270,0,17184,15904,18844,233209,955224.06 +4 1,1024,1.4.5,1.4.6,3557880,3557880,0,31528,20488,35188,118596,971538.4 +32 2,1024,1.4.5,1.4.6,3557880,3557880,0,34068,17948,36628,118596,971538.4 +32
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: numeric sort on substring
by kennethk (Abbot) on Jan 06, 2011 at 16:36 UTC | |
by mikeraz (Friar) on Jan 06, 2011 at 17:40 UTC | |
|
Re: numeric sort on substring
by Anonyrnous Monk (Hermit) on Jan 06, 2011 at 16:41 UTC | |
|
Re: numeric sort on substring
by moritz (Cardinal) on Jan 06, 2011 at 16:58 UTC | |
by Anonyrnous Monk (Hermit) on Jan 06, 2011 at 17:10 UTC | |
|
Re: numeric sort on substring
by Jim (Curate) on Jan 07, 2011 at 00:24 UTC | |
by johngg (Canon) on Jan 07, 2011 at 09:26 UTC | |
by Jim (Curate) on Jan 08, 2011 at 00:14 UTC | |
by johngg (Canon) on Jan 27, 2011 at 13:39 UTC | |
by salva (Canon) on Jan 27, 2011 at 14:48 UTC |