$x = "MAAGAAAAFAAAATTTTTTTTFTTTTTTTTTTTTAAAAEAAAARAAAAAA"; $y = "TTTTTTTTFTTTTTTTTTTTT"; if ($x =~ /$y/o) {print "the second amino acid is in the first";} if ($y =~ /$x/o) {print "the first amino acid is in the second";}