Call it reverse engineering the book. Larry has a base64-to-uuencode converter in the cammel book, and I needed the reverse so I could build a client to the Velar Central Archive. So here's a few subroutines I built to help out. (And unlike mhttpd, it's more perl translating than looping)
# Convert data to base64 sub base64 { my($line)=@_; my($r); $r=pack "u",$line; $r=~ s/^.(.+)$/$1/; $r=~ tr# -_#A-Za-z0-9+/#; return $r; } # base64 back to reality sub unbase64 { my($line)=@_; my($r); $line =~ tr#A-Za-z0-9+/##cd; $line =~ tr#A-Za-z0-9+/# -_#; $r=pack("c", 32 + 0.75*(length $line)); return unpack("u", $r . $line); }

Replies are listed 'Best First'.
(chromatic) RE: Base64 by the (cammel) book
by chromatic (Archbishop) on Jul 11, 2000 at 08:27 UTC
    How about replacing $r=~ s/^.(.+)$/$1/; with substr $r, 0, 1, '';? Could be faster, if you need to do a lot of these.