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
perldoc -q intersection
Hopes
perl -le '$_=$,=q,\,@4O,,s,^$,$\,,s,s,^,b9,s,$_^=q,$\^-]!,,print'