my @sorted = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { my ($n,$t) = split('|:|',$_,2); [$_,$t] } @origarray; # change this to sort by lower case: [$_,lc($t)]