hi monks
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 ];
I want the intersection of those three arrays. That is, in the above example, the correct answer is
[ 3 ].
Here's 2 other examples:
$ids{'foo'}-> [ 5 ];
answer:
[ 5 ]
$ids{'foo'}->[ 3, 4, 5, 6 ];
$ids{'bar'}->[ 4, 5, 6, 7 ];
$ids{'zoo'}->[ 5, 6, 7, 8 ];
answer is
[ 5, 6 ]
$ids{'foo'}->[ 3, 4, 5, 6 ];
$ids{'bar'}->[ 4, 5, 6, 7 ];
$ids{'zoo'}->[ 5, 6, 7, 8 ];
$ids{'goo'}->[ 9, 10, 11 ];
answer:
[ ] # undef
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!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.