Created
October 10, 2011 04:26
-
-
Save tatzyr/1274633 to your computer and use it in GitHub Desktop.
http://goo.gl/t6U1J を見て慣れないPerlを使って12分で書いたFizzBuzz
This file contains hidden or 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 | |
use strict; | |
use warnings; | |
local ($,, $\) = ("\n", "\n"); | |
print map{ | |
if ($_ % 15 == 0) { | |
"FizzBuzz" | |
} elsif ($_ % 3 == 0) { | |
"Fizz" | |
} elsif ($_ % 5 == 0) { | |
"Buzz" | |
} else { | |
$_ | |
} | |
} (1..shift); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment