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";
In reply to Re: Count of words that match in an array
by stephen
in thread Count of words that match in an array
by Al Shiferaw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |