use strict; use warnings; my $source1 = '[TCG]GGGG[AT]'; # ambiguous my $target1 = 'AGGGGC'; # No of mismatch = 2 on position 1 and 6 my $target2 = 'TGGGGC'; # No of mismatch = 1 on position 6 only # Turn the source into a regexp that accepts any character at each # position, but only captures the matches (my $sourcepat = $source1) =~ s/(\[.*?\]|.)/(?:($1)|.)/g; for ($target1, $target2) { # Substitute _ for undef in the matches returned my @result = map defined()?$_:'_', /$sourcepat/; print "$_: @result\n"; } __DATA__ Output is: AGGGGC: _ G G G G _ TGGGGC: T G G G G _
In reply to Re: Mismatch Positions of Ambiguous String
by Roy Johnson
in thread Mismatch Positions of Ambiguous String
by monkfan
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |