Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Code requested for array intersection count

by tcf22 (Priest)
on Jun 09, 2003 at 15:16 UTC ( #264348=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @a1 = qw( A B );
    my @a2 = qw( A B C D A D B A C );
    ...
        my $count = grep /^$el$/, @a2;
        print "$el is in Array2 $count times\n";
    }
    
  2. or download this
    A is in Array2 3 times
    B is in Array2 2 times
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2020-09-22 15:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (129 votes). Check out past polls.

    Notices?