@a = qw(a b c b c); @b = qw(a x c d d); #### for(0..$#a){ if($a[$_] eq $b[$_] and $a[$_] ne 'x' ){ etc. etc. }elsif( ){ } }