in reply to need help comparing DNA compliments

First, you are not comparing strings, you are comparing arrays.

As this is not C, you don't need a for loop to get the length of an array: just say:

$counter=@dna;$counter2=@comp;
Assigning an array to a scalar assigns the length of the array to the scalar (OK, we're talking about context here, but I'm not going into a detailed discussion)

And your cycles are a bit out of whack... you are saying:

  1. if @dna is not empty (while (@dna))
  2. count how many bases I have in @dna
  3. count how many bases I have in @comp
  4. check if the one past last element of each list is a correct pairing
  5. etc

I'll not write here a "correct" solution, since many other people already have. I'll just write a (commented) snippet for the case of strings:

my $dna; # the sequence, as a string my $comp; # the complement, as a string my $c2; ($c2=$comp)=~tr[ATGC][TACG]; # copy $comp into $c2, then exchange each + base in $c2 with its complement (using the tr-ansliteration operator +) print "Match!\n" if $dna eq $c2; # since $c2 is $comp's complement, it + should be equal to $dna

-- 
        dakkar - Mobilis in mobile