#!/usr/bin/perl
# make three strings of nucleotides
$dna1 = “AAAAAAAAAAAAAAATGAAAAAAAAAAAAAAAA”;
$dna2 = “AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”;
$dna3 = “ATGAAAAAAAAAATGAAAAAAAAAAAATGAAAA”;
$pattern = “ATG”;
# match pattern to dna1
$m = $dna1 =~ m/$pattern/g;
print “Was the ATG pattern found in dna1 : $m \n”;
# match pattern in dna2
$m2 = $dna2 =~ m/$pattern/g;
print “Was the ATG pattern found in dna2 : $m2 \n”;
# find the position of the pattern match in dna1
$pos = index($dna1, $pattern);
print “The match position of ATG in dna1 is : $pos \n”;
# replace the ATG sites with CCC
$dna3 =~ s/ATG/CCC/g;
print “Replaced dna3 with CCC is : $dna3 \n”;