<?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: Read lines from input file – print lines that match a regular expression]]></title>
	<link>https://bioinformaticsonline.com/snippets/view/27268/read-lines-from-input-file-%E2%80%93-print-lines-that-match-a-regular-expression?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/view/27268/read-lines-from-input-file-%E2%80%93-print-lines-that-match-a-regular-expression?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/27268/read-lines-from-input-file-%E2%80%93-print-lines-that-match-a-regular-expression</guid>
	<pubDate>Tue, 10 May 2016 11:46:19 -0500</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/27268/read-lines-from-input-file-%E2%80%93-print-lines-that-match-a-regular-expression</link>
	<title><![CDATA[Read lines from input file – print lines that match a regular expression]]></title>
	<description><![CDATA[<code>#!/usr/bin/perl
use strict;
use warnings;

my $line;

#read the line-by-line for each line ask if it matches the regex print it if it matches

while($line = &lt;DATA&gt;){
        chomp $line;
        if ($line =~ /^ATG?C*[ATCG]+?A{3,10}$/) {
                print &quot;$line\n&quot;;
        }
}

exit();

__DATA__
ATGCCCAA
ATGCCCAAAA
ATGCCCAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD</code>]]></description>
	<dc:creator>Nishi Singh</dc:creator>
</item>

</channel>
</rss>