my @newArr = map { # put it all back together join '', @$_ } sort { # dereference and sort numerically by 2nd element $a->[1] <=> $b->[1] } map { # break off the digits and put in an anonymous array [ split /(\d+)/ ] } @arr;