in reply to Code requested for array intersection count
Try using grep.
producesmy @a1 = qw( A B ); my @a2 = qw( A B C D A D B A C ); foreach my $el(@a1){ my $count = grep /^$el$/, @a2; print "$el is in Array2 $count times\n"; }
A is in Array2 3 times B is in Array2 2 times
|
---|
In Section
Seekers of Perl Wisdom