Please make sure that you cut and paste the code here, instead of re-writing or writing from scratch in the question box. That would eliminate typographical errors.
my @dna = qw(A T C G);
my $counter;
foreach my $i (1..$#dna){
my $base = $dna[$i-1];
my $pair = $dna[$i];
print "$base$pair\n";
}