This is the most compact form, but it is not well suited for printing or embedding in places that can't handle arbitrary data.
Consider using sha256_base64, or stick with sha256_hex:
use Digest::SHA qw(sha256_hex sha256_base64);
my $data1 = '0123456789ABCDEF';
my $data2 = 'FEDCBA9876543210';
my $digest1 = sha256_hex ($data1 . $data2);
my $digest3 = sha256_base64($data1 . $data2);
print "This is a hexdigest->" . $digest1, "\n";
print "This is a base64digest->" . $digest3, "\n";
This is a hexdigest->b4a5e0ad9fce13bf90bcb09147ba9200431389e28fa40eaa2
This is a base64digest->tKXgrZ/OE7+QvLCRR7qSAEMTieKPpA6qKg3NQdZURHA
What output format do you need?
1 Referencing Digest, because SHA says: “The programming interface is easy to use: it’s the same one found in CPAN’s Digest module.”
Athanasius <°(((>< contra mundum