Sample code for 30+ languages & platforms
Perl Requires Chilkat v11.2.0+

Base62 Encoding and Decoding

Demonstrates base62 encoding and decoding.

Chilkat Perl Downloads

Perl
use chilkat();

$bd = chilkat::CkBinData->new();

#  Base62 encode.
$bd->AppendString("hello world","utf-8");
$base62_encoded = $bd->getEncoded("base62");
print "hello world --> " . $base62_encoded . "\r\n";

#  Output: 
#  hello world --> AAwf93rvy4aWQVw

#  Base62 decode
$sb = chilkat::CkStringBuilder->new();
$sb->DecodeAndAppend("AAwf93rvy4aWQVw","base62","utf-8");
print "decoded: " . $sb->getAsString() . "\r\n";

#  Output:
#  decoded: hello world