Nice! But...

use Digest::MD5::File qw(file_md5);

Ok, but then you're using Digest::MD5 instead, which indeed is loaded by Digest::MD5::File. You may just either use the former since it's a core module now or take advantage of the latter:

my $myfile = shift; my $md5 = new Digest::MD5; $md5->addpath($myfile); my $digest = $md5->hexdigest; Win32::Clipboard::Set ($digest);

I would just either

Win32::Clipboard::Set Digest::MD5->new->addpath(shift)->hexdigest;

or

Win32::Clipboard::Set file_md5 shift;

in the two respective cases hinted above.

Oh, and I wouldn't print $digest; since we're putting that info in the clipboard anyway, but I would use wperl.exe instead. Of course an alternative would be a minimal GUI (e.g. Tk) showing the computed checksum, possibly along with a button to copy to the clipboard or compare with a value previously stored into it. However this would loose the fascinating simplicity/minimality of your solution...


In reply to Re: Calc md5 for file by drag and drop (Windows) by blazar
in thread Calc md5 for file by drag and drop (Windows) by GrandFather

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.