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++; } }