<?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: Parse a Fasta file with Perl]]></title>
	<link>https://bioinformaticsonline.com/snippets/view/27325/parse-a-fasta-file-with-perl?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/view/27325/parse-a-fasta-file-with-perl?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/27325/parse-a-fasta-file-with-perl</guid>
	<pubDate>Fri, 13 May 2016 05:00:18 -0500</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/27325/parse-a-fasta-file-with-perl</link>
	<title><![CDATA[Parse a Fasta file with Perl]]></title>
	<description><![CDATA[<code>#!/usr/bin/env perl

# Usage:  fastaRead.pl data.fa

use strict;
use warnings;

my $filename = $ARGV[0];
my  $sequence;
open my $fileH, &quot;&lt;&quot;, $filename or die &quot;could not open $filename\n&quot;;
while (&lt;$fileH&gt;) {
    chomp;
    if ($_ =~ /^&gt;/) {
        print &quot;this line is a header: $_\n&quot;;
    }
    else {
        print &quot;this line contains sequence data: $_\n&quot;;
        # Concatenate everything from the file into a single var
        $sequence .= $_;
    }
}
close $fileH;</code>]]></description>
	<dc:creator>Radha Agarkar</dc:creator>
</item>

</channel>
</rss>