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

(minimal version)

Date:06/01/05
Author:Mark Sheppard
URL:n/a
Comments:1
Info:n/a
Score: (3.01 in 132 votes)
This one's slightly longer than the original (155 bytes), but the output's more
correct - it doesn't have an "s" after "1 bottle" and it has punctuation at the
end of each line:

sub b{$n=99-@_-$_||No;"$n bottle"."s"x!!--$n." of beer"};$w=" on the wall";
die map{b."$w,\n".b.",\nTake one down, pass it around,\n".b(0)."$w.\n\n"}0..98

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
bottled by Acme::EyeDropsAndrew Savige06/04/0576
for signatureRandolph Chung, Joey Hess04/20/050
standard versionJim Menard04/20/052
bottled versionChristopher J. Carlson05/17/057
Lingua::EN::InflectMarty Pauley04/20/051
object-oriented versionScott Bryce05/15/051
polyglotJeff Connelly04/20/050
BigIntAnonymous04/20/050

Comments

>>  Andrew Savige said on 06/05/05 02:54:21

Andrew Savige Here is a version that produces identical output to the one submitted by Mark Sheppard, but in only 132 bytes, the shortest so far. This solution was concocted by Ton Hospel and Mtv Europe.

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

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: