in reply to The Perl Review
Looks like a great contender to replace the downtrodden TPJ. Anyone interested in the golf-master position detailed below?
Perl GolfUpdate: To get it started, here is my first attempt.... 61 charsWe have not figured out the rules, chosen the judges, or calculated what your chances of winning really are, but we do have the prizes – Perl Mongers hats or tshirts along with a chance for fame and glory in the next issue of The Perl Review.
Solve the following problem with a ridiculously low number of keystrokes, uses Perl in some clever or devious way, or is otherwise interesting and send it to comdog@panix.com.
Convert a base 36 number, with the digits [0-9A-Z], to its base 10 representation
If you would like to be a judge, or the maintainer of this column, or have an interesting golf problem, let us know. We can send you a hat or a t-shirt too.
#!/usr/bin/perl -wT use strict; my $base36 = shift; $base36 = 10 if !defined $base36; die "invalid input, only 0-9 and A-Z allowed\n" if $base36 !~ /^[0-9A-Z]+\z/; my $dec = base36($base36); print "$base36 => $dec\n"; sub base36 { # 1 2 3 4 5 6 #234567890123456789012345678901234567890123456789012345678901 $%+=$_*36**$?++for reverse map/\d/?$_:ord($_)-55,pop=~/./g;$% }
-Blake
|
---|
Replies are listed 'Best First'. | |
---|---|
Re (tilly) 2: Fore!!! (was The Perl Review)
by tilly (Archbishop) on Feb 01, 2002 at 22:30 UTC | |
by blakem (Monsignor) on Feb 02, 2002 at 00:14 UTC | |
by tilly (Archbishop) on Feb 02, 2002 at 00:44 UTC | |
by Anonymous Monk on Feb 02, 2002 at 00:53 UTC | |
by blakem (Monsignor) on Feb 02, 2002 at 01:16 UTC | |
by jackdied (Monk) on Feb 02, 2002 at 10:06 UTC | |
by tilly (Archbishop) on Feb 02, 2002 at 14:54 UTC | |
Re: Fore!!! (was The Perl Review)
by jynx (Priest) on Feb 02, 2002 at 01:35 UTC |
In Section
Meditations