perlmeditation
Ovid
<p>In stumbling across [http://tickletux.wordpress.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/|this disturbing writeup], the author claims that not only can the majority of comp-sci majors not solve the 'fizzbuzz' problem, but he's also seen "senior" programmers take 10 or 15 minutes to solve it:</p>
<blockquote>Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.</blockquote>
<p>Naturally, I whipped out a quick snippet just to make sure I knew how to program:</P>
<code>$ perl -le 'for (1..100) {print("FizzBuzz"), next if not $_%15; \
print("Buzz"), next if not $_%5; print("Fizz"), next if not $_%3; print}';
</code>
<p>Since I'm lousy at golf, I figured I wouldn't try to shorten that, but I figured that a few of you might care to try a few rounds.</p>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-17000">
<p>Cheers,<br />
<a href="/index.pl?node=Ovid&lastnode_id=1072">Ovid</a></p>
<p><small>New address of <a href="http://users.easystreet.com/ovid/cgi_course/">my CGI Course</a>.</small></p>
</div></div>