james289o9 has asked for the wisdom of the Perl Monks concerning the following question:
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 :)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' );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: compare md5 from file against entire@md5 array
by hippo (Archbishop) on Dec 04, 2013 at 13:21 UTC | |
by MidLifeXis (Monsignor) on Dec 04, 2013 at 14:38 UTC | |
by james289o9 (Acolyte) on Dec 04, 2013 at 13:52 UTC | |
|
Re: compare md5 from file against entire@md5 array
by MidLifeXis (Monsignor) on Dec 04, 2013 at 13:42 UTC | |
by james289o9 (Acolyte) on Dec 04, 2013 at 13:53 UTC | |
|
Re: compare md5 from file against entire@md5 array
by locked_user sundialsvc4 (Abbot) on Dec 04, 2013 at 14:00 UTC | |
by james289o9 (Acolyte) on Dec 04, 2013 at 14:16 UTC | |
by james289o9 (Acolyte) on Dec 04, 2013 at 14:20 UTC | |
by Jim (Curate) on Dec 05, 2013 at 02:15 UTC |