in reply to Golf Challenge: FizzBuzz
My first shot ... how do we count?
perl -le'print(($_%3?"":Fizz).($_%5?"":Buzz)or$_)for 1..100'
Edit: Bah, it's practically merlyn's entry with less whitespacemore golfing. :)
Edit2: With BrowserUK's counting standard, I get 50 if I can assume -l (as he seems to):
sub fizzBuzz { #23456789 123456789 123456789 123456789 123456789 print(($_%3?"":Fizz).($_%5?"":Buzz)or$_)for 1..100 }
... and 5352 if I can't:
sub fizzBuzz { #23456789 123456789 123456789 123456789 123456789 12 print+($_%3?"":Fizz).($_%5?"":Buzz)||$_,$/for 1..100 }
print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!
|
---|