Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use strict;
- use warnings;
- use utf8;
- use v5.10;
- use Readonly;
- sub numify { $_[0] ? "1" : "0" }
- my $i = 1;
- my $result = "";
- Readonly my %table => (
- "00" => "other",
- "10" => "fizz",
- "01" => "buzz",
- "11" => "fizzbuzz",
- );
- loop:
- goto end if $i > 100;
- my $key = numify($i % 3 == 0) . numify($i % 5 == 0);
- goto $table{$key};
- fizz:
- $result = "Fizz";
- goto finally;
- buzz:
- $result = "Buzz";
- goto finally;
- fizzbuzz:
- $result = "FizzBuzz";
- goto finally;
- other:
- $result = $i;
- goto finally;
- finally:
- say $result;
- $i++;
- goto loop;
- end:
Add Comment
Please, Sign In to add comment