in reply to Count every 3rd base occurence
I think what you are looking for is something more along these lines (as a for loop):
Here the $i is incremented by three every time through the loop, which I believe is what you wanted.for ( my $i = 2; $i < @dna; $i = $i+3 ) { print "$dna[$i] at position $i\n"; if ( $dna[$i] eq 'C' or $dna[$i] eq 'G') { $counter++; } }
-enlil
|
|---|