Language Perl
(standard version)
Date: | 04/20/05 |
Author: | Jim Menard |
URL: | n/a |
Comments: | 2 |
Info: | n/a |
Score: | (3.02 in 175 votes) |
#!/usr/bin/perl # Jim Menard jimm@{bbn,io}.com (617) 873-4326 http://www.io.com/~jimm/ $nBottles = $ARGV[0]; $nBottles = 100 if $nBottles eq '' || $nBottles < 0; foreach (reverse(1 .. $nBottles)) { $s = ($_ == 1) ? "" : "s"; $oneLessS = ($_ == 2) ? "" : "s"; print "\n$_ bottle$s of beer on the wall,\n"; print "$_ bottle$s of beer,\n"; print "Take one down, pass it around,\n"; print $_ - 1, " bottle$oneLessS of beer on the wall\n"; } print "\n*burp*\n";
Download Source | Write Comment
Alternative Versions
Version | Author | Date | Comments | Rate |
---|---|---|---|---|
bottled by Acme::EyeDrops | Andrew Savige | 06/04/05 | 76 | |
for signature | Randolph Chung, Joey Hess | 04/20/05 | 0 | |
bottled version | Christopher J. Carlson | 05/17/05 | 7 | |
Lingua::EN::Inflect | Marty Pauley | 04/20/05 | 1 | |
minimal version | Mark Sheppard | 06/01/05 | 1 | |
object-oriented version | Scott Bryce | 05/15/05 | 1 | |
polyglot | Jeff Connelly | 04/20/05 | 0 | |
BigInt | Anonymous | 04/20/05 | 0 |
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments
Lat1n0S said on 02/21/06 00:52:10
Kill himself!
Christopher E. Stith said on 08/20/08 18:30:15
I was disappointed that no new examples in Perl are to be accepted. There are some neat and clever versions there, but none showcasing particularly mainstream coding practices. Something more representative of how the Perl community suggests code is written might be desirable.