Created
August 8, 2017 03:11
-
-
Save managedkaos/ed9ed34bf4960afca43641b42a063039 to your computer and use it in GitHub Desktop.
FizzBuzz implemented in Perl.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
foreach $number (1..100) { | |
$three = 0; | |
$five = 0; | |
if (($number % 3) == 0) { | |
print 'Fizz'; | |
$three = 1; | |
} | |
if (($number % 5) == 0) { | |
print 'Buzz'; | |
$five = 1; | |
} | |
if ($three || $five) { | |
print "\n"; | |
} else { | |
print "$number\n"; | |
} | |
} |
Author
managedkaos
commented
Aug 8, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment