Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: (jeffa) Re: 99 bottles of beer on the Wall

by ignatz (Vicar)
on Aug 21, 2002 at 13:24 UTC ( #191724=note: print w/ replies, xml ) Need Help??


in reply to (jeffa) Re: 99 bottles of beer on the Wall
in thread 99 bottles of beer on the Wall

Getting rid of the warning and making it just a little bit prettier:

#!/usr/bin/perl -w use strict; use Lingua::EN::Nums2Words; my $beer = shift || 99; $beer = abs($beer); print how_many($beer), ",\n", how_many($beer), ".\n", "Take one down, pass it around,\n", how_many(--$beer), ".\n\n" while $beer; sub how_many { my $numb = &num2word(shift); $numb =~ s/(\w)(.*)/\u$1\L$2/; return $numb . ' bottle' . ($numb eq 'One' ? '' : 's') . ' of beer on the wall' ; }
Requires Lingua::EN::Nums2Words.
()-()
 \"/
  `                                                     


Comment on Re: (jeffa) Re: 99 bottles of beer on the Wall
Download Code
Re: Re: (jeffa) Re: 99 bottles of beer on the Wall
by ignatz (Vicar) on Aug 21, 2002 at 13:36 UTC
    Here's the first joke that I can remember telling as a kid. It still cracks em up today.
    #!/usr/bin/perl -w use strict; use Lingua::EN::Nums2Words; my $beer = shift || 99; $beer = abs($beer); for (-9..$beer) { print how_many($beer), ",\n", how_many($beer), ".\n", "Take one down, pass it around,\n", how_many(--$beer), ".\n\n" } sub how_many { my $numb = &num2word(shift); $numb =~ s/(\w)(.*)/\u$1\L$2/; return $numb . ' bottle' . ($numb eq 'One' ? '' : 's') . ' of beer on the wall' ; }
    ()-()
     \"/
      `                                                     
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2014-09-20 04:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (152 votes), past polls