use Digest::MD5; use Digest::MD5::File; ..... $filemd5->addfile($MD5); my $md5value = $filemd5->hexdigest(); push @md5list,"$md5value,$file"; } my $targetmd5 = $p00path . $p00 . '.md5'; my $MD5 = undef; if (not open ($MD5,'>',$targetmd5)) { print "Could not open $targetmd5 for write,Error: $!\n"; next P00; } my $qcmd5 = Digest::MD5->new(); # Make MD5 Object for checksum print $MD5 "# MD5 File for Optical Media ID $p00\n"; print $MD5 "# ISO created by $name $datestring\n"; foreach my $line (@md5list) { $qcmd5->add($line); print $MD5 "$line\n"; } my $folderMD5 = Digest::MD5::File->new; $folderMD5->adddir($p00path); my $finalmd5 = $folderMD5->hexdigest; print $MD5 "CHECKSUM: $finalmd5\n"; close $MD5; print "Made MD5 file for $p00\n";