Hi,
I have one perl script for comparing two text file entries. But its not working according to my expectation. Its comparing line by line, not like comparing one entry to the complete file. I like the script to be compare all the entries irrespective of line by line comparison.
$f1 = 'E:\upload\new\2.txt';
open FILE1, "$f1" or die "Could not open file \n";
$f2= 'E:\upload\new\a.txt';
open FILE2, "$f2" or die "Could not open file \n";
$outfile = 'E:\upload\new\1.txt';
my @outlines;
foreach (<FILE1>) {
$y = 0;
$outer_text = $_;
seek(FILE2,0,0);
foreach (<FILE2>) {
$inner_text = $_;
if($outer_text eq $inner_text) {
$y = 1;
print "$outer_text, Match found \n";
last;
}
}
if($y != 1) {
print "$outer_text,No Match Found \n";
push(@outlines, $outer_text);
}
}
open (OUTFILE, ">$outfile") or die "Cannot open $outfile for writing \n";
print OUTFILE @outlines;
close OUTFILE;
close FILE1;
close FILE2;
Can anybody please help me to enhace the script.
Thanks in advance
Vinod