in reply to Comparing 2 arrays too find the total number of identical elements.
Basically you need hash to track the elements of the arrays. Here's a clue:
If you iterate the %hash you'll get list of unique elements and the number of each element in the arrays. You can do that, right? I mean the hash iteration. Let us know after you try that. Good luck, barrymcv :-)my @array1 = qw(perl monks camel); my @array2 = qw(node thread monks); my %hash; for (@array1, @array2) { $hash{$_}++; }
Oh wait, why didn't you tell us you already asked about this? What did you learn from there, and what went wrong so you need to ask again with a bit different question?
Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!
|
|---|