in reply to need help comparing DNA compliments

Looks suspiciouly like a homework assignment to me, but as you've actually posted code, here goes...:)

The first two lines stuff the arrays with the individual letters - it's not obvious from your code whether this is initially the case or not.

The '%pairs' hash demonstrates one way of avoiding large numbers of 'if' statements.
my @dna = split("","ATCTGCG"); my @comp = split("","TCTGCAA"); my %pairs = qw(A T T A G C C G); foreach (0..$#dna) { my $d = $dna[$_]; my $c = $comp[$_]; print "$_: $d - $c is a mispair\n" unless ($pairs{$d} eq $c); }
Hope this helps.

Update ROFLMAO! Marvellous how so many people can come up with the same routine written so many ways in 5 minutes :) Go monks! :)