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 );

In reply to Can't update file by TClayJ

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.