Changes
From Biolecture.org
Created page with "<p><span style="font-size:14px"><strong>There is given sequence, and if there is MKKTGIKG in sequence, it will match and print it to the new "output.txt" file.</strong>..."
<p><span style="font-size:14px"><strong>There is given sequence, and if there is MKKTGIKG in sequence, it will match and print it to the new "output.txt" file.</strong></span> </p>
<p><span style="font-size:14px">#!/usr/bin/perl<br />
use strict;<br />
use warnings;<br />
open(<strong>OUT</strong>, ">output.txt") or die "Can't open file $_\n"; ##it creates new text file<br />
my <strong>$seq</strong> ="ASMKATAHQMKKTGIKGMSTYALLRL";<br />
if (<strong> $seq =~ /(MKKTGIKG)</strong>/){ ##finding particular matchings in a scalar variable<br />
<strong>print OUT "$1\n"; ##$1 means matched item in a parenthesis</strong><br />
}<br />
else { print OUT $seq;} ##if there is no match, will print out original sequence</span><br />
</p>
<p><span style="font-size:14px">#!/usr/bin/perl<br />
use strict;<br />
use warnings;<br />
open(<strong>OUT</strong>, ">output.txt") or die "Can't open file $_\n"; ##it creates new text file<br />
my <strong>$seq</strong> ="ASMKATAHQMKKTGIKGMSTYALLRL";<br />
if (<strong> $seq =~ /(MKKTGIKG)</strong>/){ ##finding particular matchings in a scalar variable<br />
<strong>print OUT "$1\n"; ##$1 means matched item in a parenthesis</strong><br />
}<br />
else { print OUT $seq;} ##if there is no match, will print out original sequence</span><br />
</p>