Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language Perl

(standard version)

Date:04/20/05
Author:Jim Menard
URL:n/a
Comments:1
Info:n/a
Score: (3.08 in 118 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

VersionAuthorDateCommentsRate
bottled by Acme::EyeDropsAndrew Savige06/04/0553
polyglotJeff Connelly04/20/050
Lingua::EN::InflectMarty Pauley04/20/050
bottled versionChristopher J. Carlson05/17/055
object-oriented versionScott Bryce05/15/051
minimal versionMark Sheppard06/01/051
for signatureRandolph Chung, Joey Hess04/20/050
BigIntAnonymous04/20/050

Comments

>>  Lat1n0S said on 02/21/06 00:52:10

Lat1n0S Kill himself!

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!

Name:

eMail:

URL:

Security Code:
  
Comment: