in reply to Complicated pattern match

Surround every character in string A with capturing parens (warning: untested code ahead):
my $re = join("([wxyz]*)", "", split("", $A), ""); if (my @array = $B =~ /^$re$/) { print "$_\n" for grep length, @array; }
On a related note, I wrote Amino acid sequence builder awhile ago, which doesn't really fit this problem, but you might find it interesting anyway.

Updated. And the code is tested now. Though due to misunderstanding the problem (clarified in the CB), the "[wxyz]*" should be "[ACTG]*?"