Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Count of words that match in an array

by stephen (Priest)
on May 10, 2002 at 03:05 UTC ( [id://165583]=note: print w/replies, xml ) Need Help??


in reply to Count of words that match in an array

use strict; my @Array1 = ("A", "B", "C", "D"); my @Array2 = ("J", "C", "T", "A"); my %seen = (); foreach (@Array1) { $seen{$_}++ }; my $count = 0; foreach (@Array2) { exists $seen{$_} and $count++; } print "Number of duplicates: $count\n";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-19 20:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found