Hi, I have a bit of script that's supposed to compare two files which are fairly identical, at the moment it's outputting the whole contents of the second file though and I really have no idea why.
use warnings;
use strict;
use File::Compare;
use Text::Diff;
use lib "E:\\Program Files (x86)\\Traverse\\lib\\perl";
use lib "C:\\Perl";
my $expect = `expect.expect`;
chdir $ARGV[0];
rename "output.new","output.old";
open DIFF, ">alarm.log" or die $!;
open OUTPUT, ">output.new" or die $!;
print OUTPUT "$expect\n";
if (compare("1.log","2.log") == 0) {
print "They're equal\n";
} else {
print "They are NOT equal\n";
print DIFF "------------------------------------------------------
+-------------------------------------------------------------\n";
+
print DIFF "The script has identified the following changes:\n\n";
+
my $diff = diff "output.new", "output.old", { STYLE => "Unified" ,
+ OUTPUT => \*DIFF };
print DIFF "------------------------------------------------------
+-------------------------------------------------------------\n\n";
+
close(DIFF);
}
If I've missed anything glaringly obvious then please let me know, I can add the files to compare if needed but like I said, they're identical apart from 2 or three lines.
Thanks