[kw-pm] Last night's meeting

John Macdonald john at perlwolf.com
Fri Jun 19 08:15:57 PDT 2009


On Fri, Jun 19, 2009 at 10:55:25AM -0400, Daniel R. Allen wrote:
> ...We had considered the ?:1 operator, on the board, but didn't see where
> it got us. Clearly we didn't stare at it long enough.
> 
> But turning rand()<1/++$n into rand++$n<1 into rand$.<1 is sheer genius
> on both of your parts. Nicely done, John and Raymond.
> 
> 29 strokes == winner?

In my previous message, I talked about "cheating" by providing
executable code that is not part of the char count in various
ways (-M switch, and the filename).

But that trick I played on the -n switch made me realize that
using -n is similarly a cheat because it provides code that is
not counted.

So what is the best non-cheating char count?

$ perl -e '@a=<>;print at a[rand(@a)]' <alpha.html

That's better than the "cheating" we've been doing using -n!

And then, it can be golfed down a bit more to:

$ perl -e 'print at a[rand(@a=<>)]' <alpha.html


So, that's down to 18 chars, with no supporting cheats of any kind.


More information about the kw-pm mailing list