Sample code for 30+ languages & platforms
Perl

StringBuilder GetEncoded

Demonstrates the Chilkat StringBuilder GetEncoded method.

Chilkat Perl Downloads

Chilkat2 Perl
use strict;
use warnings;
use Chilkat2;

my $s = 'The quick brown fox jumps over the lazy dog';

my $sb = Chilkat2::StringBuilder->new;

$sb->Append($s);

# output: The quick brown fox jumps over the lazy dog
print $sb->GetAsString(), "\n";

# Get the string encoded to base64, without changing the contents of sb.
# output: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==
print $sb->GetEncoded('base64', 'utf-8'), "\n";

# The contents of sb are not changed..
# output: The quick brown fox jumps over the lazy dog
print $sb->GetAsString(), "\n";