perl if eq statement no work in array
I have a string
$seq1= 'ATCGATGCAATTCCGGAAAAAATTTTCCCGGGGGGGAAACCCGGGAAATTT'
so i want to find the frequence of char from user input in this string.
So i change this string to array
$base= <STDIN>; # you can input A or T or C or G
my @Freq1= split //, $seq1;
Then use for loop to calculate the total number of char
for(my $i=0;$i<@Freq1;$i++) {
if($Freq1[$i] eq chomp($base)) {
print "equals $i\n";
$numberbase++;
}
}
But the $Freq1[$i] eq chomp($base) can't work. I don't know why?
No comments:
Post a Comment