Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: 99 Bottles Of Beer (can't we do better)

by mojotoad (Monsignor)
on Feb 20, 2002 at 06:05 UTC ( #146509=note: print w/ replies, xml ) Need Help??


in reply to 99 Bottles Of Beer (can't we do better)

Anonsub hell, with proper pronoun management (tm)...

#!/usr/bin/perl $nBottles = abs(shift || 100); $p_sub = sub { 'Take ' . (shift == 1 ? 'it' : 'one') . " down, pass it around,\n" }; $b_sub = sub { 'bottle' . (shift != 1 ? 's' : '') }; $c_sub = sub { $_ = shift||'No'; "$_ " . &$b_sub($_) . ' of beer' }; $w_sub = sub { &$c_sub(shift) . " on the wall"; }; $sub = sub { $_ = shift; print &$w_sub($_), ",\n", &$c_sub($_), ",\n", &$p_sub($_), &$w_sub(--$_), ".\n\n" }; map(&$sub($_), reverse(1 .. $nBottles)); print "burp!\n";
Matt


Comment on Re: 99 Bottles Of Beer (can't we do better)
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://146509]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2015-07-04 02:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls