in reply to Re: loop and counter question
in thread loop and counter question

$dna1 was a typo

Replies are listed 'Best First'.
Re: loop and counter question
by Abigail-II (Bishop) on Feb 25, 2003 at 14:38 UTC
    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