A few comments:

For deleting a file, instead of shelling out to "rm", use the built in Perl function unlink. It is much faster and is portable across OS'es. Update: unlink returns the number of files deleted. So you can easily tell if it worked or not.

This open, open ( MD5, '+>>', $md5File ), looks weird to me. I'd have to dig around a bit in the docs and do some experiments to figure exactly what that is going to do. I guess that means, read / append. In any event, you are just reading the file. Use open ( MD5, '<', $md5File ) instead. That more accurately describes what you are doing with the file.

BTW, '+<' would be the normal way to open an existing file for read/write. '>+' is also read/write, but clobbers the file when opened initially (starts with a blank file). Its been awhile since I worked with a read/write file. Usually you need an intervening seek to flush buffers when switching between read and write. I'm not sure about '+>>'. In any event, you are not doing both reading and writing on this file, so there is no need to open with a mode that would allow that.

print "md5row    = ${md5row}\n"; There is no need for the {} here. &loggingError(...) There is no need for the &. You can read more at perlsub.

Update: This code, $md5row = <MD5>; reads a line including the line ending character(s) from the file handle MD5. I think that you need a chomp $md5row; to get rid of the line ending character(s).


In reply to Re: Can't update file by Marshall
in thread 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.