[JaxPM] Base 36 to Base 10
J Proctor
jproctor at marlboro.edu
Wed Feb 20 11:19:18 CST 2002
On the jacksonville-pm-list; Jax.PM'er J Proctor <jproctor at marlboro.edu> wrote -
> This is the smallest I can make the code and still understand it
> myself :)
What are you talking about? There are at least 4 unnecessary line breaks.
#!perl
use strict;
while(<DATA>){my$z;chop;split//;for(@_){s#\D#-55+ord$&#e;$z=36*$z+$_}print"$z "}
Here you go. The body is 80 characters long, and runs in strict mode. I
considered obscuring the algorithm a little better, but it's been a long
week already (and it's only Wednesday). Too bad it only works on
uppercase letters. :)
j
Jax.PM Moderator's Note:
This message was posted to the Jacksonville Perl Monger's Group listserv.
The group manager can be reached at -- owner-jacksonville-pm-list at pm.org
to whom send all praises, complaints, or comments...
More information about the Jacksonville-pm
mailing list