Well, $dna is the reversed complement of $array1[$i]. But you are comparing it to itself.
Now there will be strings that will match this way (AATT for
instance), but you say you want GTTC to match GAAC.
That's two things you want to compare. But you are comparing
one thing with itself. I'm not sure what you where you want
to compare your dna fragments with.