Created
April 3, 2015 12:48
-
-
Save mikeda/3985996d1262b7571155 to your computer and use it in GitHub Desktop.
fizzbuzz
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/perl | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
my $num = 100; | |
for my $i ( | |
1..$num | |
) | |
{ | |
if ( $i % 15 == 0 ) | |
{ | |
print "FizzBuzz"; | |
} | |
elsif( $i % 3 == 0 ) | |
{ | |
print "Fizz"; | |
} | |
elsif( $i % 5 == 0 ) | |
{ | |
print "Buzz"; | |
} | |
else | |
{ | |
print $i; | |
} | |
print "\n"; | |
} | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment