for(0..$#a){ if($a[$_] eq $b[$_] and $a[$_] ne 'x' ){ etc. etc. }elsif( ){ } }