Create a FASTA file with a sequence. Open it and reverse the sequence of it and print it out in another FASTA file by MJ

From Biolecture.org

#Code

print "Input your file name with .txt :";
my $file_name;
$file_name = <>;

open(TEXT, "$file_name");
@dna = <TEXT>;
close(TEXT);

chomp(@dna);

my $dna = join "", @dna;
my $reverse;

for(my $i= length($dna)-1; $i>=0; $i-=1)
{
    $reverse .= substr($dna,$i,1);  
}

print "Reversed sequence is : ";
print $reverse;

<>;

 

 

#Result

 

 

 

 

Perl Programming HW by MJ 20180604