Counting the frequencies of bases using for loop and substr in perl -
Counting the frequencies of bases using for loop and substr in perl - i'm trying count number of bases using loop , substr function counts off , i'm not sure why! please help! have utilize these functions in assignment. going wrong? here code: use strict; utilize warnings; $user_input = "accgtutf5"; #initalizing lengths $a_base_total = 0; $c_base_total = 0; $g_base_total = 0; $t_base_total = 0; $other_total = 0; ( $position = 0; $position < length $user_input; $position++ ) { $nucleotide = substr( $user_input, $position, 1 ); if ( $nucleotide eq "a" ) { $a_base_total++; } elsif ( $nucleotide eq "c" ) { $c_base_total++; } elsif ( $nucleotide eq "g" ) { $g_base_total++; } elsif ( $nucleotide eq "t" ) { $t_base_total++; } else { $other_total++; } $position++; } print "a = $a_base_total\n"; print "c = $c_base_total\n"; print...