in reply to Comparison between files and report

Your needs seem pretty clear to me.
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

Replies are listed 'Best First'.
Re^2: Comparison between files and report
by Anonymous Monk on Feb 07, 2006 at 16:53 UTC
    Thank you,

    That is what I needed.

    Scott