New golf was Re: New Perl magazine
Tony Bowden
tony at kasei.com
Sat Feb 2 11:13:59 CST 2002
On Sat, Feb 02, 2002 at 04:13:54PM +0000, Stray Toaster wrote:
> sub a{ord$_<58?$_:(ord$_)-55}
> @l=reverse split'',shift;
> $n+=a($_)*36**$s++for at l;
> print$n
I took a similar approach at first... (although mine deals with many
rather than one)
-F// -pale '$_=0;$n=36**@F;for$d(@F){$d=$o-55if($o=ord$d)>64;$_+=($n/=36)*$d}'
But I dont' really like the algorithm ... I think there's a better way
in general...
Tony
More information about the Belfast-pm
mailing list