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

Re: YN golf

Thread Previous | Thread Next
Zed Lopez
March 31, 2008 17:28
Re: YN golf
Message ID:
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            
Zed Lopez PO Box 12546 Berkeley CA 94712

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