#!/usr/bin/perl -w use Digest::MD5; open CONFIGFILE, "md5TEMP" or die "I cant write the MD5's temp file."; my $a = 0; my $b = 0; my $change=0; open OLDMD5, ") { chomp; $file = $_; open(FILE, $file) or die "Can't open $file"; binmode(FILE); $md5 = Digest::MD5->new; while () { $md5->add($_); } close(FILE); print RESULTS $md5->b64digest, " ", $file, "\n"; #print $md5->b64digest, "\n"; $a=$a+1; } close RESULTS; close CONFIGFILE; open RESULTS, "; my @file2 = ; close OLDMD5; #See what's different while ($a != $b) { if ($file1[$b] ne $file2[$b]) { print $file1[$b]; $change=1; } $b=$b+1; } #If they differ, then update the oldMD5 file to the newest one. $b=0; if ($change eq 1) { open OLDMD5, ">md5" or die "I cant write the MD5's file."; while ($a != $b) { print OLDMD5 $file1[$b]; $b=$b+1; } } close RESULTS; close OLDMD5;