use String::ShellQuote qw( shell_quote );
sub perl_quote { qq{"\Q$_[0]\E"} }
my $email_lit = perl_quote( $email );
my @cmd = (
"perl",
"-MDigest::SHA=sha256_hex",
"-e", "print sha256_hex( $email_lit )",
$email,
);
my $cmd = shell_quote( @cmd );
my $email_SHA256 = qx($cmd);
die "Can't spawn child: $!\n" if $? == -1;
die "Child killed by signal ".( $? & 0x7F )."\n" ) if $? & 0x7F;
die "Child exited with error ".( $? >> 8 )."\n" ) if $? >> 8;
####
use String::ShellQuote qw( shell_quote );
my @cmd = (
"perl",
"-MDigest::SHA=sha256_hex",
"-e", 'print sha256_hex( $ARGV[0] )',
$email,
);
my $cmd = shell_quote( @cmd );
my $email_SHA256 = qx($cmd);
die "Can't spawn child: $!\n" if $? == -1;
die "Child killed by signal ".( $? & 0x7F )."\n" ) if $? & 0x7F;
die "Child exited with error ".( $? >> 8 )."\n" ) if $? >> 8;
####
use IPC::System::Simple qw( capturex );
my @cmd = (
"perl",
"-MDigest::SHA=sha256_hex",
"-e", 'print sha256_hex( $ARGV[0] )',
$email,
);
my $email_SHA256 = capturex( @cmd );
####
use Digest::SHA qw( sha256_hex );
my $email_SHA256 = sha256_hex( $email );