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

Re: 99 bottles of beer on the wall

From:
Ronald J Kimball
Date:
May 24, 2003 22:03
Subject:
Re: 99 bottles of beer on the wall
Message ID:
20030525050307.GB4855@linguist.thayer.dartmouth.edu
On Sun, May 25, 2003 at 02:57:48PM +1000, Andrew Savige wrote:
> As you might expect, I cannot resist re-opening this golf game,
> after a half-time break of four and a half years:

Then please consider my more recent version...  :)

$n=pop||99;sub b{"$n bottle@{[$n!=1&&s=>]} of beer"}print$b=b,$w=' on the wall',
",\n$b,\nTake one down, pass it around,\n",b($n--),"$w.\n"while$n

Ronald

P.S.  Yes, you can save characters by using literal newlines, but I find
that cheesy, and it makes the code difficult to execute as a command line.



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