in reply to Re^2: compare files by words
in thread compare files by words
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: compare files by words
by ysth (Canon) on May 31, 2007 at 10:02 UTC | |
by blazar (Canon) on May 31, 2007 at 10:30 UTC | |
by ysth (Canon) on May 31, 2007 at 19:18 UTC |