in reply to Re^2: for loops
in thread Count every 3rd base occurence

Why so complicated? ;)

my $count=0; $count += substr($dna, $_, 1) =~ /[CG]/ for map 3 * $_, 1 .. length($d +na)/3; print $count;

Examine what is said, not who speaks.