Quicker way to compare these 2 strings?by Anonymous Monk
|on May 19, 2010 at 00:07 UTC||Need Help??|
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello fellow Monks!
I have 2 strings, namely:
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.