my $file1 = "file1.txt"; my $file2 = "file2.txt"; my $file3 = "output.txt"; my $match = 0; # Open the files for reading open( FILE1, $file1 ); open( FILE2, $file2 ); while ( <FILE1> ) { my $string1 = $_; my $string2 = <FILE2>; print "$counter: $string1\n$string2\n\n\n"; ++$match if ( $string1 eq $string2 ); } close FILE1; close FILE2; if ( $match ) { open( FILE3, '> $file3' ); print FILE3 "$match lines matched\n"; close FILE3; }
-- -- GhodMode
In reply to Re: Comparison between files and report
by GhodMode
in thread Comparison between files and report
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |