in reply to Re: is there a more simple way to have the intersection of two lists ?
in thread is there a more simple way to have the intersection of two lists ?
You are missing a $_ there. And it doesn't work. (Consider @list1=(); @list2=qw(foo foo);.)my %seen; $seen{$_}=1 for @list1; my @intersection = grep ++$seen{}==2, @list2;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: is there a more simple way to have the intersection of two lists ?
by ikegami (Patriarch) on Mar 19, 2008 at 06:48 UTC |