#/usr/bin/perl -W
use strict;
use warnings;
use Digest::MD5;
my $in_file = $0;
$in_file = $ARGV[0] if (@ARGV);
sub get_hex_digest($) {
   my ($fil) = shift;
   if (open FILE, "<$fil") {
      binmode FILE;
      my $md5 = Digest::MD5->new;
      while (<FILE>) {
         $md5->add($_);
      }
      close FILE;
      return $md5->hexdigest;
   } else {
      print "Error: Unable to open file [$fil]\n";
      exit(1);
   }
}
print "MD5 digest of [$in_file] = [".get_hex_digest($in_file)."]\n";
exit(0);
