Skip to content

Instantly share code, notes, and snippets.

@pera
Last active December 31, 2015 09:59
Show Gist options
  • Save pera/7970159 to your computer and use it in GitHub Desktop.
Save pera/7970159 to your computer and use it in GitHub Desktop.
FizzBuzz
print+(join'',("FizzBuzz"=~/./g)[$_**2%3*4..7-$_**4%5*4])||$_,$/for 1..100;
print+($_,'Fizz','Buzz','FizzBuzz')[!($_%3)|!($_%5)<<1].$/for 1..100;
print+($_,'Fizz','Buzz','FizzBuzz')[!($_%3)+!($_%5)*2].$/for 1..100;
print+($_%15?$_%5?$_%3?$_:'Fizz':'Buzz':'FizzBuzz').$/for 1..100;
print+('Fizz')[$_%3].('Buzz')[$_%5]||$_,$/for 1..100; #it may give warnings
print'Fizz'x!($_%3).'Buzz'x!($_%5)||$_,$/for 1..100;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment