array looks like this: category_Title Words_1 category_Title Words_2 category_Title Words_3 category_Title Words_4 ($sub1, $sub2, $sub3) = split (/\_/, @array,3); $sub3 = sort { $b <=> $a } $sub3; doesn't work. i've also tried: my @newarray = ($sub1,$sub2,$sub3); @newarray = sort { $a->[2] cmp $b->[2] } @newarray;