i wrote this script and finally figured out, after hours and hours of searching, how to compare two md5 checksums:
use warnings;
use strict;
use Digest::MD5;
my $file = "$ARGV[0]";
my $file1 = "$ARGV[1]";
open (my $fh, '<', $file) or die "Can't open '$file': $!";
binmode ($fh);
open (my $fh1, '<', $file1) or die "Can't open '$file': $!";
binmode ($fh1);
my $md5 = Digest::MD5->new->addfile($fh)->hexdigest;
my $md51 = Digest::MD5->new->addfile($fh1)->hexdigest;
print "\n", $file, "\n", $md5, "\n", "\n", $file1, "\n", $md51, "\n";
if ($md5 eq $md51) {
print "\n", "The MD5's match perfectly", "\n";
} else {
print "\n", "The MD5's do NOT match", "\n";
}
system ( 'pause' );
but what i really need to do is get the md5 from $ARGV0 and compare that against an entire predefined @md5 array. essentially the $ARGV1 will be replaced by an array. i have searched and searched how to accomplish this.
Like i say, all i need to do is compare the ARGV0 md5 against an entire array of md5's.
any help or input would be very much appreciated :)