I am trying to update a file that contains the md5 checksum for a file if the value in the file is different from the new md5checksum but it is not updating. Here is the code, any suggestions are greatly appreciated.
if ( &download( $url, $save_file ) ) {
# Successfully downloaded, now compair previous md5 value
# and if different move to the transfer folder
my ( $guidId, $ext ) = split ( '.zip', $guid );
my $md5File = "${hifld_md5_folder}/${guidId}.md5";
open ( MD5, '+>>', $md5File )
|| &loggingError("Couldn't open md5 file ($md5File) for
+ reading : $!");
$md5row = <MD5>;
close( MD5 );
my $md5chksum = &calcMD5( $save_file );
print "md5row = ${md5row}\n";
print "md5chksum = ${md5chksum}\n\n";
# check to see if the file has changed since the last down
+load
# if not then delete the downloaded file otherwise
# update the md5 file and rename the downloaded file for m
+oving
if ( $md5row = $md5chksum ) {
my $cmd = "rm $save_file";
# `$cmd`;
} else {
# Update the md5 file
open ( MD5OUT, '>', $md5File )
|| &loggingError("Couldn't open md5 file ($md5File)
+for writing : $!");
print MD5OUT "${md5chksum}";
close( MD5OUT );