use Lingua::EN::Numbers qw(num2en); sub make_key { $_ = shift; s/^(?:The|An|A) // || s/^[^A-Z_]+(\d+)/num2en; return $_; } my @movies = ( '(500) Days of Summer', # F for Five hundred 'The Music Man', # M for Music 'The Good, the Bad, and the Ugly' # G for Good ); # Here's the transform. Read from the bottom up. my @movies = # original elements replaced with same, but sorted map { $_->[1] } # pull off second element from each sort { $a->[0] cmp $b->[0] } # sort arrays on first elements map { [ make_key($_), $_ ] } # 2-element anonymous array becomes new $_ @movies; print "$_\n" for @movies; __END__ Prints: (500) Days of Summer The Good, the Bad, and the Ugly The Music Man