Okay, after taking in some ideas and punching up some code.... I came out with this:
use Digest::MD5;
use Algorithm::Diff;
open CONFIGFILE, "<config.ini" or die "I cant open the config file.";
open RESULTS, ">md5TEMP" or die "I cant write the MD5's temp file.";
open OLDMD5, "<md5" or die "I cant read the MD5's file.";
while (<CONFIGFILE>) {
chomp;
$file = $_;
open(FILE, $file) or die "Can't open $file";
binmode(FILE);
$md5 = Digest::MD5->new;
while (<FILE>) {
$md5->add($_);
}
close(FILE);
print RESULTS $md5->b64digest, " ", $file, "\n";
print $md5->b64digest, "\n";
}
close RESULTS;
open RESULTS, "<md5TEMP" or die "I cant read the MD5's temp file.";
while (<OLDMD5>) {
$changes = diff (<OLDMD5>, <RESULTS>);
print $changes;
}
close OLDMD5;
if ($changes != "") {
open OLDMD5, ">md5" or die "I cant write the MD5's file.";
while (<RESULTS>) {
print OLDMD5 $_;
}
}
It fails to work with this error Undefined subroutine &main::diff called at dascript.pl line 27, <RESULTS> line 2. What am I doing wrong to compare the two files? russ