There is a cpan provided Perl module MIME::Base64, using this, you can do the base64 decoding and encoding process easily.
Base64 is use exactly 64 character, and using the 64 characters one string converts into a totally different looks shape. The 64 characters are using at base64 are A-Z, a-z, 0-9, + and /
While any extra bit of padding requires, an equal(=) sign just used other than 64 characters. Below is a simple example that will just convert the timestamp integer into base64 string. And return it into integer form after decoding.
$base64_string = time();
$encoded = encode_base64($base64_string);
print "Encode $encoded";
## now decode this encoded data again.
$decoded = decode_base64($encoded);
print "Decode $decoded";
To learn more about base64 encoding and decoding, here is wikipedia http://en.wikipedia.org/wiki/Base64
Also can take a look it at from cpan http://search.cpan.org/~gaas/MIME-Base64-Perl-1.00/lib/MIME/Base64/Perl.pm
If you like the article, then you must like my Perl articles http://icfun.blogspot.com/search/label/perl, That's all for today.