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

Re: YN golf

Thread Previous | Thread Next
From:
Zed Lopez
Date:
March 31, 2008 17:28
Subject:
Re: YN golf
Message ID:
20080331232208.GA51031@kamidake.apricot.com
On Mon, Mar 31, 2008 at 05:50:24PM -0500, Uri Guttman wrote:
> perl -le 'print join "\n", map {tr/01/NY/; $_} map unpack( "b5", chr), 0 .. 31'

Also, I'm sure, easily bested:

perl -e 'for(0..31){$_=sprintf"%05b\n",$_;y/01/YN/;print}

marginally shorter not-to-hoyle hybrid: 
seq 0 31|perl -pe '$_=sprintf"%05b\n",$_;y/01/YN/'

--
zed at-sign apricot dot com                      http://www.MemeMachineGo.com/
Zed Lopez PO Box 12546 Berkeley CA 94712


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About