Works fine for me with the proper quoting.
$ echo -n joe.smith@aol.com | sha256sum 4d1612632ab95a0dec3d27f521d2b91cabe9e72a6b1ecdb8784e1ed6f3a93604 - $ perl -MDigest::SHA=sha256_hex -E 'say sha256_hex(q/joe.smith@aol.com +/)' 4d1612632ab95a0dec3d27f521d2b91cabe9e72a6b1ecdb8784e1ed6f3a93604
Your problem is that you are using double quotes which interpolate and using neither strict nor warnings which would have drawn your attention to the undeclared and uninitialised array.
$ perl -wE 'use Digest::SHA "sha256_hex"; say sha256_hex("joe.smith@ao +l.com")' Possible unintended interpolation of @aol in string at -e line 1. Name "main::aol" used only once: possible typo at -e line 1. 4ea2142392947d467539285b3c6e98f073d9d85910f2a1d535f86a95358ab9dd $ perl -Mstrict -wE 'use Digest::SHA "sha256_hex"; say sha256_hex("joe +.smith@aol.com")' Possible unintended interpolation of @aol in string at -e line 1. Global symbol "@aol" requires explicit package name (did you forget to + declare "my @aol"?) at -e line 1. Execution of -e aborted due to compilation errors.
Always use strict and warnings. Always.
🦛
In reply to Re^4: Perl SHA256
by hippo
in thread Perl SHA256
by BOK_NEPA
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |