In Chapter 4, Section 4.8 (Computing Union, Intersection, or Difference of Unique Lists), the Perl Cookbook provides this technique for getting the intersection of two lists
Here's one map/grep approach:
map
grep
my @a = qw(Perl PHP Ruby Python C JavaScript); my @b = qw(erlang java perl python c snobol lisp); my @intersection = grep { defined } @{ { map { lc ,=> $_ } @a } } { map { lc } @b }; # @intersection = qw(Perl Python C)