>"accession #"_"biotype"
^^
"sequence"
####
use strict;
use warnings;
# Constants
my $genfile = "c:\bemisia_coi.gb";
my $outfile = "$accession_$biotype";
my ($OUT, $IN);
my $line;
print "Input: $genfile\n";
open($IN, "$genfile") or die "cannot open $genfile\n";
while ($line = <$IN>) {
$line = lc $line; #case insensitive
my @line = split(/\///,$line);
foreach my $i (0..$#line) {
my $accession = "/locus\s*([a-z]{8})";
my $biotype = "/biotype: ([a-z]{1})";
my $sequence = "/origin(\*+)\//\";
$sequence =~ s/\s//g; #Removing spaces
$sequence =~ s/\d//g; #Removing numbers
open($OUT, '>' "$outfile") or die "cannot open $outfile \n";
print "Printing to $outfile \n";
print($OUT ">$accession_$biotype/n^^/n$sequence");
}
}