Reputation: 403
I am getting the following errors when running the code:
syntax error line 5, near "use Digest::MD5
sub makeKey
"
syntax error at line 8, near "}"
syntax error at line 15, near ")
}"
Execution aborted due to compilation errors.
My script:
use lib '/home/me/Desktop/pm/MD5.pm';
use Digest::MD5
sub makeKey
{
my ($strPassword, $strRndk);
$strKey = uc(md5Hash($strPassword)) + $strRndk + "Y(02.>'H}t\":E1" + md5Hash($strKey);
return $strKey;
}
sub md5Hash
{
my ($strPassword);
$strMd5 = md5_hex($strPassword);
return substr($strMd5, 16, 16) + substr($strMd5, 0, 16);
}
makeKey('test', '1A2B3C');
Upvotes: 0
Views: 1029
Reputation: 434665
Concerning your third (and final?) problem:
"Undefined subroutine &main::md5_hex called on line 14"
Digest::MD5
doesn't export md5_hex
(or anything else) by default, you have to explicitly tell it that it should export md5_hex
:
use Digest::MD5 qw(md5_hex);
or use the full Digest::MD5::md5_hex
name.
Upvotes: 4