Category: | Fun Stuff |
Author/Contact Info | |
Description: | Some time ago, there was a thread on clpmisc on writing 99 Bottles of Beer on the Wall in Perl. After exploring elegant solutions, posters turned to shorter solutions. At the time, the shortest solution took up three lines. With some spare time and nothing better to do, I recently succeeded in squeezing this program to two lines of Perl (fewer than 80 characters per line). Enjoy! |
$n=pop||99;sub b{"$n bottle@{[$n!=1&&s=>]} of beer"}print$b=b,$w=' on
+the wall'
,", $b!\nTake one down, pass it around,\n",b($n--),"$w!\n\n"while$n
|
Back to
Code Catacombs