A hash slice would (I guess) be more efficient (insted of the map-statement).
my %hash; @hash{@array2};
This code will set for all the elements in @array2 the value in the hash to undef. And later on you can see if it exists by using the exists (or not exists) function (as done in your code).
In reply to Re^4: comparing arrays
by Animator
in thread comparing arrays
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |