Created
May 16, 2010 15:54
-
-
Save toritori0318/402948 to your computer and use it in GitHub Desktop.
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
package FizzBuzz; | |
use warnings; | |
use strict; | |
use Carp; | |
use version; our $VERSION = qv('0.0.1'); | |
# Module implementation here | |
sub new { bless {} }; | |
sub say { | |
my $self = shift; | |
my $n = shift||0; | |
return "FizzBuzz" if _fizzbuzz($n); | |
return "Fizz" if _fizz($n); | |
return "Buzz" if _buzz($n); | |
$n; | |
} | |
sub _fizzbuzz { | |
$_[0]%15 == 0; | |
} | |
sub _fizz { | |
$_[0]%3 == 0; | |
} | |
sub _buzz { | |
$_[0]%5 == 0; | |
} | |
1; | |
__END__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment