Its almost 2 same files. They differs in diacritic only. And i just need to know how many words have different diacritic. I dont need to know details.
In this case your approach above seems fine. Did you try it? Did it fail somehow? One thing you "have" to do is to make it strict-safe. Then, for words comparison I'd write:
no warnings 'uninitialized';
($words1[$_] eq $words2[$_] ? $good : $bad)++
for 0..(@words1>@words2 ? $#words1 : $#words2);
(I suppose you want to count a word as bad if it has not a correspondent one at all. Otherwise you should change > into <. In the latter case no wouldn't be necessary.)
Update: you also probably don't want to split on / /, but on ' ' which is more likely to do what you mean, and in fact is also the default. |