in reply to reading lines from 2 different files
use warnings; use strict; open my $fh1, '<', 'file1.txt' or die "Can not open file1.txt $!\n"; open my $fh2, '<', 'file2.txt' or die "Can not open file2.txt $!\n"; while (<$fh1>) { chomp; my $line_f2 = <$fh2>; chomp $line_f2; if ($_ ne $line_f2) { print "Mismatch at line $.\n"; print "file1: $_, file2: $line_f2\n"; } } close $fh2; close $fh1;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: reading lines from 2 different files
by ikegami (Patriarch) on Oct 08, 2007 at 18:58 UTC | |
by toolic (Bishop) on Oct 08, 2007 at 19:15 UTC |