Perl syntax error [closed]
- by Linny
I am a beginner taking a Perl programming course. We are trying to write a basic program for counting nucleotides in a DNA string. I'm getting syntax errors on the lines that have a single bracket on lines 28 & 70 and don't know why.
It also reads that I have compilation errors. I have no idea where to start figuring that out.
#
The purpose of this program is to count the number of nucleotides in a strand. Each protein is counted separately
#
print "/n NOTE: Nucleotide counting /n";
#
use strict; # enforce variable declarations
use warnings; # enable compiler warnings
#
Display number of A,a,T,t,G,g,C,c, nucleotides in a word or sequence of letters.
#
my ($base) = ''; # an extracted letter from a string
my ($nuceotide_count) = 0 ; # the current position within the word
my ($position) = 0 ; # number of vowels in user-supplied word
my ($word) = ''; # word to be processed
my ($A_count) = 0 ; # of A nucleotides in the user-supplied sequence
my ($a_count) = 0 ; # of A nucleotides in the user-supplied sequence
my ($C_count) = 0 ; # of C nucleotides in the user-supplied sequence
my ($c_count) = 0 ; # of C nucleotides in the user-supplied sequence
my ($G_count) = 0 ; # of G nucleotides in the user-supplied sequence
my ($g_count) = 0 ; # of G nucleotides in the user-supplied sequence
my ($T_count) = 0 ; # of T nucleotides in the user-supplied sequence
my ($t_count) = 0 ; # of T nucleotides in the user-supplied sequence
word = (STDIN)
for ($position = 0);($position
if (($base eq 'a') or ($base eq 'A'))
{
++$A_count;
} # end if
++$position;
if (($base eq 'T') or ($base eq 't'))
{
++$T_count;
} end if
++$position;
if (($base eq 'G') or ($base eq 'g'))
{
++$G_count;
} # end if
++$position;
if (($base eq 'C') or ($base eq 'c'))
{
++$C_count;
} # end if
++$position;
} # end for
#
Display final results.
#
print " \n The number of A or a neucleotides is: $A_count";
print " \n The number of T or t neucleotides is: $T_count";
print " \n The number of G or g neucleotides is: $G_count";
print " \n The number of C or c neucleotides is: $C_count";
print " \n\n Program completed successfully. \n" ;
exit ;