Both your and Errto’s solutions violate your spec: they will ignore duplicate elements in @x, but they report duplicate matches in @y.
The best I’ve come up with that works correctly is 49 characters (or 51 if you care about the context issue).
Makeshifts last the longest.
In reply to Re: Perl Golf-- testing array intersection
by Aristotle
in thread Perl Golf-- testing array intersection
by BUU
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |