Assuming that each number can only appear once in each list, then the following should work:-
my %counts = (); foreach my $val (@d1, @d2, @d3) { $counts{$val}++; } return grep { $counts{$_} == 3 } sort keys %counts;
In reply to Re: Getting the intersection of n collections.
by dtr
in thread Getting the intersection of n collections.
by jbrugger
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |