vegasjoe has asked for the wisdom of the Perl Monks concerning the following question:
I know so far that the "tr///" operator performs a substitution on the individual characters in a string. I know how to build at uuencoded string by hand. By taking the ASCII decimal value of the character, then converting the ASCII to binary. Next shifting the left 6 bits and converting back to decimal. Next, add 32 to the new value to get a ASCII code back (A_Za-z0-9+/). So my question is how does the following do that in one step?$str =~ tr|A-Za-z0-9+/| -_|; # convert to uuencoded format
This code snippet comes from MIME::Base64::Perl decode_base64() function.$str =~ tr|A-Za-z0-9+/| -_|;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Converting To Uuencoded Format
by ikegami (Patriarch) on Dec 11, 2008 at 18:02 UTC | |
|
Re: Converting To Uuencoded Format
by gone2015 (Deacon) on Dec 11, 2008 at 18:20 UTC | |
|
Re: Converting To Uuencoded Format
by ig (Vicar) on Dec 11, 2008 at 20:21 UTC |