Perl
Perl
Base64 Encode/Decode a String
See more Encryption Examples
_LANGUAGE_ example to base-64 encode and decode a string.Chilkat Perl Downloads
use strict;
use warnings;
use Chilkat2;
my $bd = Chilkat2::BinData->new;
my $s = 'A friend called me up the other day and talked about investing in a dot-com that sells lobsters. Internet lobsters. Where will this end? --Donald Trump';
my $success = $bd->AppendString($s, 'utf-8');
my $strBase64 = $bd->GetEncoded('base64');
print $strBase64, "\n";
# To decode:
my $bd2 = Chilkat2::BinData->new;
$bd2->AppendEncoded($strBase64, 'base64');
my $decoded = $bd2->GetString('utf-8');
print $decoded, "\n";