Just one comment more.
In perlfaq4 you have a chunk of code to evaluate union, intersection a difference from two arrays.
"How do I compute the difference of two arrays? How do I compute the intersection of two arrays?"
You can see question/answer here