note 33238 deleted from function.md5 by mazzanet
| From: | mazzanet@php.net | Date: | Sun, 12 Jun 2005 22:48:09 +0000 |
| Subject: | note 33238 deleted from function.md5 by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-90333@lists.php.net to get a copy of this message | ||
Note Submitter: Michael Siroskey
----
The problem experienced by lee at fallingforward dot net was probably caused by using double
quotes around the variable in Perl. If double quotes are used ($pa$$) then Perl interprets
syntax symbols ($, @) as variables for lookup. In this case $$ will display the current pid for the
running Perl process and not $$. To prevent this from happening you either need to escape
syntax symbols or you can use single quotes ($pa$$') to prevent it from doing variable
lookup.
# Incorrect Code
#--------------------------------------
$string = "pa$$";
require Digest::MD5;
$md5 = Digest::MD5->new;
$md5->add($string);
$digest = $md5->hexdigest;
print $digest,"\n";
# Correct Code
#--------------------------------------
$string = pa$$;
require Digest::MD5;
$md5 = Digest::MD5->new;
$md5->add($string);
$digest = $md5->hexdigest;
print $digest,"\n";
Hope this helps.
Michael Siroskey
Developer @ 2Checkout.com