⭐ in reply to How can I find the union/difference/intersection of two arrays?
This is inefficient, but I use it for intersection when I know I'm guaranteed small list sizes, and it's more valuable / pleasing to me to have a one-line solution:
my @isect = map { my $b = $_; grep { $_ eq $b } @a } @b;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Answer: How can I find the union/difference/intersection of two arrays?
by Anonymous Monk on Nov 16, 2017 at 16:10 UTC |