$ perl -MO=Deparse -e 'my @intersection = grep { defined } @{ { map { lc ,=> $_ } @a } } { map { lc } @b }; ' my(@intersection) = grep({defined $_;} @{+{map({lc $_, $_;} @a)};}{map {lc $_;} @b}); -e syntax OK