in reply to loop and counter question

How can we tell where the mistake is? We don't know what's in either of @dna and @dna1.

Abigail

Replies are listed 'Best First'.
Re: Re: loop and counter question
by Anonymous Monk on Feb 25, 2003 at 14:09 UTC
    $dna1 was a typo
      So, what's in @dna then? Letters? Strings? If you have the sequence in a sequence $dna, you could do:
      print "$_ " for $dna =~ /(?=(..))/g;

      If you have individual letters in an array, you could use:

      print @dna [$_ - 1, $_], " " for 1 .. $#dna;

      Abigail