And if you want to have a look at another one's code for doing base64, look at the source for MIME::Base64::Perl.
It is much more clean and short than your code, mainly because it uses the "u" template in its pack and unpack functions to first encode/decode the data to uuencode standard (which is very close to base64) and then, after doing some cleanup, uses tr to replace the uuencode characters by base64 characters in a one-to-one replacement. Fast, clean and easy to maintain.
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey JamesMy blog: Imperial Deltronics
<code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>