basscakes has asked for the wisdom of the Perl Monks concerning the following question:
i think i didn't ask my question right last time, but i've done a lot of experiments. anyway, supposing my data looks like this (more or less same as last time):
$ids{'foo'}-> [ 3, 4, 5 ]; $ids{'bar'}-> [ 3 ]; $ids{'zoo'}-> [ 3, 4, 5 ];
Here's 2 other examples:
answer: [ 5 ]$ids{'foo'}-> [ 5 ];
answer is [ 5, 6 ]$ids{'foo'}->[ 3, 4, 5, 6 ]; $ids{'bar'}->[ 4, 5, 6, 7 ]; $ids{'zoo'}->[ 5, 6, 7, 8 ];
answer: [ ] # undef$ids{'foo'}->[ 3, 4, 5, 6 ]; $ids{'bar'}->[ 4, 5, 6, 7 ]; $ids{'zoo'}->[ 5, 6, 7, 8 ]; $ids{'goo'}->[ 9, 10, 11 ];
i don't care to know which $id they were in, i JUST want the array that represents elements that showed up at least once in ALL arrays. thanks!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: intersection of N arrays
by davido (Cardinal) on Jun 30, 2004 at 22:44 UTC | |
Re: intersection of N arrays
by pbeckingham (Parson) on Jun 30, 2004 at 22:30 UTC | |
Re: intersection of N arrays
by Ido (Hermit) on Jun 30, 2004 at 22:43 UTC | |
Re: intersection of N arrays
by jZed (Prior) on Jul 01, 2004 at 00:35 UTC | |
Re: intersection of N arrays
by reyjrar (Hermit) on Jun 30, 2004 at 22:42 UTC | |
by Solo (Deacon) on Jul 01, 2004 at 02:51 UTC | |
by jarich (Curate) on Jul 07, 2004 at 15:14 UTC | |
by nkuitse (Sexton) on Jul 02, 2004 at 14:58 UTC | |
Re: intersection of N arrays
by bageler (Hermit) on Jul 01, 2004 at 06:04 UTC | |
by Solo (Deacon) on Jul 01, 2004 at 13:29 UTC | |
by Anonymous Monk on Aug 24, 2020 at 02:55 UTC | |
by AnomalousMonk (Archbishop) on Aug 24, 2020 at 04:32 UTC | |
Re: intersection of N arrays
by husker (Chaplain) on Jul 01, 2004 at 13:55 UTC | |
by melora (Scribe) on Jul 01, 2004 at 23:19 UTC | |
by husker (Chaplain) on Jul 02, 2004 at 13:58 UTC | |
by melora (Scribe) on Jul 02, 2004 at 15:15 UTC | |
by melora (Scribe) on Jul 12, 2004 at 17:59 UTC |