in reply to Re^2: merging dna sequences
in thread merging dna sequences

This one is inspired by moritz's solution, which only replaced the last "T" with a "K" in the first string. It has one less bit-op than my original, so should be a bit faster. (LOL... that one snuck up on me while typing)
my $s = 'AYGTACTAGACTACAGACTACAGACATCTACAGACTCATCAGCAGCATATTTA'; my $t = 'ACGTACTAGACTACAGACTACAGACATCTACAGACTCATCAGCAGCATATTKA'; (my $del = $t) =~ tr/ACGTA-Z/\0\0\0\0_/; (my $add = $t) =~ tr/ACGT/_/; my $merged = ($s | $del) & $add; say $merged;