for ($i = 1; $i < @dna; $i++) { if ($dna[$i+3] eq 'C') { $counter++; } elsif ($dna[$i+3] eq 'G') { $counter++; } }