Skip to content

Instantly share code, notes, and snippets.

@toritori0318
Created May 16, 2010 15:54
Show Gist options
  • Save toritori0318/402948 to your computer and use it in GitHub Desktop.
Save toritori0318/402948 to your computer and use it in GitHub Desktop.
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