Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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??

Help for this page

Select Code to Download


  1. or download this
    my @tocheck;
    for my $value (values %$self) {
    ...
    }
    
    return grep { $seen{$_} == @tocheck } keys %seen;
    
  2. or download this
    my ($n, %seen);
    for my $array (values %$self) {
    ...
      $n++;
    }
    return grep { $seen{$_} == $n } keys %seen;
    
  3. or download this
    my %seen;
    for my $value ( map { ref($_) eq 'ARRAY' ? @$_ : () } values %$self ) 
    +{
      $seen{$value}++;
    }
    return grep { $seen{$_} > 1 } keys %seen;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://370139]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-16 04:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found