If you mean avoid duplicate matching that arises naturally from a cross-product operation, you could restrict the cross product to its unique triangle in the inner loop of a nested 3-argument 'for' construction, having the inner loop variable start off only from the value of the outer variable , e.g.:
for ( my $i = 0; $i <= $#array1; $i++ ) {
for ( my $j=$i; $j <= $#array2; $j++ ) {
# compare $array1[$i] with $array2[$j] ...
}
}