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
In reply to Re: Sorting array
by Kc12349
in thread Sorting array
by fdegir
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |