http://qs1969.pair.com?node_id=840583

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello fellow Monks!
I have 2 strings, namely:
$first= "AAAAXXXXAAAAXXXXXXXXXXXAAAA"; $second="AXXXAXXAAXXXXXAAAAXXXXXAAAA";

I want to know how many letters do they share in common. The "traditional" way that I'm thinking of is:
1) Split $first, split $second
2) Foreach letter in @split_first array, see if, in the same position in the array @split_second you have the same letter
3)Count the times you get success
Is there something quicker than that?
I just need the number of positions in the arrays (they always have the same number of letters), that the have the same letter.
Thanks!