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 );