Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: how do i find common elements of X number of arrays whose names i don't know?by integral (Hermit) |
on Jun 28, 2004 at 08:10 UTC ( [id://370139]=note: print w/replies, xml ) | Need Help?? |
Firstly to find @accessors, you can use the keys function on the %$self hash. But I'd choose to push the value rather than the key so a loop over values(%$self) might make more sense.
So far we haven't used map (but we did use grep), but we can combine the two loops together so we don't need @tocheck as an intermediate.
Here's a solution using map to replace one of the loops (Update: But it doesn't solve the right problem, since it just checks for duplicates, rather than things appearing multiple times):
In Section
Seekers of Perl Wisdom
|
|