develooper Front page | perl.fwp | Postings from May 2003

Re: 99 bottles of beer on the wall

From:
Zed Lopez
Date:
May 26, 2003 11:40
Subject:
Re: 99 bottles of beer on the wall
Message ID:
20030526183948.GC52816@kamidake.apricot.com
My solution was (added the 'pop||' to match the constraint others are
accepting of taking a parameter):

@h=map"$_ bottles of beer",0..pop||99;$h[1]=~s/s//;$o=" on the wall";$a=pop@h,print"$a$o,\n$a,\nTake one down, pass it around,\n$h[$#h]$o.\n"while$#h

149 characters, 145 with literal newlines.

Don't see a way to beat Ron's subroutine approach with the
preinitialized array approach.

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




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