Skip to content

Instantly share code, notes, and snippets.

@kothiba
Created February 12, 2017 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kothiba/71f3e23d340572831a6e622ab849f7bb to your computer and use it in GitHub Desktop.
Save kothiba/71f3e23d340572831a6e622ab849f7bb to your computer and use it in GitHub Desktop.
I wrote FizzBuzz in Perl
#!/usr/bin/env perl
use strict;
use warnings;
for my $str (1..30) {
if ($str % 3 == 0 && $str % 5 ==0) {
print "fizzbuzz\n";
} elsif ($str % 3 == 0) {
print "fizz\n";
} elsif ($str % 5 == 0) {
print "buzz\n";
} else {
print "$str\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment