jajaja has asked for the wisdom of the Perl Monks concerning the following question:
and it works :)$good=0; $bad=0; while ((defined ($line1 = <INPUT1>)) && (defined ($line2 = <INPUT2>))) { @words1 = split(/ /, $line1); @words2 = split(/ /, $line2); $wordsno = @words2; until ($wordsno-- == 0){ if ($words1[$wordsno] eq $words2[$wordsno]) { $good++; } else {$bad++;} } } print "good: $good"; print "bad: $bad"; close INPUT1; close INPUT2;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: compare files by words
by Zaxo (Archbishop) on May 31, 2007 at 06:48 UTC | |
by sanPerl (Friar) on May 31, 2007 at 10:38 UTC | |
by jajaja (Initiate) on May 31, 2007 at 07:19 UTC | |
by blazar (Canon) on May 31, 2007 at 08:25 UTC | |
by ysth (Canon) on May 31, 2007 at 10:02 UTC | |
by blazar (Canon) on May 31, 2007 at 10:30 UTC | |
|