Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Golf Challenge: FizzBuzz

by Moron (Curate)
on Mar 02, 2007 at 17:36 UTC ( [id://602915]=note: print w/replies, xml ) Need Help??


in reply to Golf Challenge: FizzBuzz

Or the slightly simplistic version that uses a precomputed LCM of 15:
print map $_%15?($_%5?($_%3?"$_\n":"fizz\n"):"buzz\n"):"fizzbuzz\n",(1 +..100);
update: typo corrected - thx liverpole

-M

Free your mind

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-03-28 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found