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

Re: 99 bottles of beer on the wall

May 26, 2003 11:36
Re: 99 bottles of beer on the wall
Message ID:
In article <baqd93$1io$3@post.home.lunix>, (Ton Hospel) writes:
> $n=pop||99;sub b{"$n bottle"."s"x!!--$n." of beer"}print$b=b,$w=" on the wall",",\n$b,\nTake one down, pass it around,\n",b,"$w.\n"while++$n

With a little more effort by mtve and me this becomes:

sub b{[@b=(abs||n.o,bottle."s"x!!++$_,of,beer),on,the,wall]}print"@{+b},\n@b,\nTake one down, pass it around,\n@{+b}.\n"for-pop||-99..-1

(which also has the "no" for 0 bottles. use ~99 if you want the song to start 
with 100 bottles). Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About