I gotta tell you that if you aren't talking about
MIME-like encodings, you are going to want to
look at pack and unpack. Also you will want to
read up on binmode if you don't want perl
messing with your data during reads and writes under
some operating systems.