Golf

garth on 2002-02-02T08:56:31

As I was watching bits of the golf on TV this afternoon, I read about the golf challenge in the Perl Review mag, and thought I would give it a try. My first attempt had the slight bug of it only working on one digit numbers, but undetered I solidered on.

I think my latest attempt actually works correctly, but has 74 characters:

for(split //,reverse shift){$c+=(ord()-(/\d/?48:55))*(36**$p++);}print $c; After looking at some of the other solutions, it would seem I need to get out the camel and read up on map and y///, as I am not really sure how these work. Who would of thought converting different base numbers could actually be fun and educational :-)