$top = 100;
$fiz = 0; $buz = 0; $fizbuz = 0;
for($count = 1; $count <= $top; $count++) {
$dfb = 0;
if($count % 3 == 0) { print "Fizz"; $dfb++; $fiz++ }
if($count % 5 == 0) { print "Buzz"; $dfb++; $buz++ }
if($dfb == 2) { $fizbuz++; $fiz--; $buz-- }
if(!$dfb) { print $count }
print " ";
}
print "\n\n".$fiz." fizzes, ".$buz." buzzes, ".$fizbuz." fizbuzzes."
Fizzbuzz in perl. My first perl program.
Edit again: I have nothing better to do right now, so I made it print how many fizzes, buzzes, and fizzbuzzes there are. I counted and it's right.