develooper Front page | perl.fwp | Postings from March 2008

YN golf

Thread Next
Uri Guttman
March 31, 2008 15:50
YN golf
Message ID:

someone posted (and it wasn't homework) for an easy way to get all
possible combos of YN (5 chars so 32 answers). he got some basic
multiline answers but i think it makes for a great golf problem.

here is my first pass which i am sure can be easily bested. i haven't
even squeezed out the white spaces but it does work.

golf away!


perl -le 'print join "\n", map {tr/01/NY/; $_} map unpack( "b5", chr), 0 .. 31'

Uri Guttman  ------  -------- --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- ---------
---------  Gourmet Hot Cocoa Mix  ---- ---------

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About