New golf was Re: New Perl magazine

Stray Toaster mwk at stray-toaster.co.uk
Sat Feb 2 10:13:54 CST 2002


On Sat, Feb 02, 2002 at 09:35:28AM +0000, Stray Toaster wrote:
> > 
> > Convert a base 36 [0-9A-Z] number to base 10 ...

Noone else has put one up, so here is mine. Publish and be damned! Yes,
I know I can cut it by a good bit, but I haven't looked at it since
about midnight last night.

m.

sub a{ord$_<58?$_:(ord$_)-55}
@l=reverse split'',shift;
$n+=a($_)*36**$s++for at l;
print$n

I can hear the laughter from here.....but it does work. And I will try
again after the footie...
-- 
Thank you for expressing an interest in this sig



More information about the Belfast-pm mailing list