in reply to is there a more simple way to have the intersection of two lists ?
Or if they couldmy %seen; my @intersection = grep ++$seen{$_}==2, @list1, @list2;
my %seen; $seen{$_}=1 for @list1; my @intersection = grep ++$seen{$_}==2, @list2;
Update: $seen{} ⇒ $seen{$_}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: is there a more simple way to have the intersection of two lists ?
by ysth (Canon) on Mar 19, 2008 at 06:40 UTC | |
by ikegami (Patriarch) on Mar 19, 2008 at 06:48 UTC |