in reply to Sorting array
This will produce your desired output, but given the meager description you have given, I can't say really if it is a solution to your issue. Please give further information and let us know if this helps.
chomp(my @unsorted = (<DATA>)); my @sorted = sort { @{[(split('-',$b))]}[0] =~ s/\d+// cmp @{[(split('-',$a))]}[0] =~ s +/\d+// || (split('-',$b))[-1] cmp (split('-',$a))[-1] } @unsorted; say for @sorted; __DATA__ ID12-ABC-5.1 ID9-ABC-5.1 ID3-ABC-6.1 ABC-5.1 ID12-ABC-5.1.5 ID15-ABC-6.1 ABC-6.1 ID5-ABC-5.1 ID5-ABC-5.1.5 ABC-5.1.5
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Sorting array
by Anonymous Monk on Sep 23, 2011 at 03:37 UTC | |
by Kc12349 (Monk) on Sep 23, 2011 at 03:47 UTC | |
by Kc12349 (Monk) on Sep 23, 2011 at 18:20 UTC | |
by Anonymous Monk on Sep 24, 2011 at 17:12 UTC | |
by Kc12349 (Monk) on Sep 23, 2011 at 18:20 UTC |