On 10/18/05, Gert <[EMAIL PROTECTED]> wrote:
> in the example below I am using Digest::MD5 for computing the md5-checksum
> for a string. The first solution uses the function md5_hex, the second way
> uses the OO method hexdigest. The results are not equal. Shouldn't they be
> equal? I think they should?

If you run your script under -w or add "use warnings", you will see

          &Digest::MD5::md5_hex function probably called as class
method at try.pl line 8.

What means that what you really want is

          my $cs= Digest::MD5::md5_hex($text);

where -> between "Digest::MD5" and "md5_hex" gives place to "::". With
this simple change, the output turns to

172b442fcbe775a552d8afda30ac6821
172b442fcbe775a552d8afda30ac6821

Your original code were computing the MD5 digest of the bareword
"Digest::MD5" plus the text. It is all there in the synopsis of
Digest::MD5 docs.

Regards,
Adriano.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to