<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: String matching with Perl]]></title>
	<link>https://bioinformaticsonline.com/snippets/view/27400/string-matching-with-perl?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/view/27400/string-matching-with-perl?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/27400/string-matching-with-perl</guid>
	<pubDate>Wed, 18 May 2016 08:37:27 -0500</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/27400/string-matching-with-perl</link>
	<title><![CDATA[String matching with Perl]]></title>
	<description><![CDATA[<code>#!/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”;</code>]]></description>
	<dc:creator>Abhi</dc:creator>
</item>

</channel>
</rss>