[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

bottles of beer (was Re: [FWP] $silly == $fun)




there was a thread in misc last december which covered this very issue
in drunken depth. here is the link to my challenge post.

http://x23.deja.com/[ST_rn=ps]/getdoc.xp?AN=425592656&search=thread&CONTEXT=934227290.555942023&HIT_CONTEXT=934227290.555942023&HIT_NUM=2&hitnum=6

here was my first version:

$n = shift || 99 ;
print <<BEER while $n ;
$n bottle@{[$s='s'x($n>1)]} of beer on the wall, $n bottle$s of beer!
Take one down and pass it around,
@{[--$n]} bottle@{['s'x($n!=1)]} of beer on the wall!

BEER


ronald started a round of perl golf and i changed mine to this:

$n=shift||99;@s='s';$o=' on the wall';print<<B while$n
@{[$b="$n bottle$s[$n<1] of beer"]}$o, $b!
Take one down and pass it around,
${\--$n} bottle$s[$n==1] of beer$o!

B


uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe