Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
10
Task/FizzBuzz/Perl/fizzbuzz-1.pl
Normal file
10
Task/FizzBuzz/Perl/fizzbuzz-1.pl
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
use feature qw(say);
|
||||
|
||||
for my $i (1..100) {
|
||||
say $i % 15 == 0 ? "FizzBuzz"
|
||||
: $i % 3 == 0 ? "Fizz"
|
||||
: $i % 5 == 0 ? "Buzz"
|
||||
: $i;
|
||||
}
|
||||
1
Task/FizzBuzz/Perl/fizzbuzz-2.pl
Normal file
1
Task/FizzBuzz/Perl/fizzbuzz-2.pl
Normal file
|
|
@ -0,0 +1 @@
|
|||
print 'Fizz'x!($_ % 3) . 'Buzz'x!($_ % 5) || $_, "\n" for 1 .. 100;
|
||||
1
Task/FizzBuzz/Perl/fizzbuzz-3.pl
Normal file
1
Task/FizzBuzz/Perl/fizzbuzz-3.pl
Normal file
|
|
@ -0,0 +1 @@
|
|||
print+(Fizz)[$_%3].(Buzz)[$_%5]||$_,$/for 1..1e2
|
||||
1
Task/FizzBuzz/Perl/fizzbuzz-4.pl
Normal file
1
Task/FizzBuzz/Perl/fizzbuzz-4.pl
Normal file
|
|
@ -0,0 +1 @@
|
|||
map((Fizz)[$_%3].(Buzz)[$_%5]||$_,1..100);
|
||||
5
Task/FizzBuzz/Perl/fizzbuzz-5.pl
Normal file
5
Task/FizzBuzz/Perl/fizzbuzz-5.pl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
use feature "say";
|
||||
|
||||
@a = ("FizzBuzz", 0, 0, "Fizz", 0, "Buzz", "Fizz", 0, 0, "Fizz", "Buzz", 0, "Fizz");
|
||||
|
||||
say $a[$_ % 15] || $_ for 1..100;
|
||||
11
Task/FizzBuzz/Perl/fizzbuzz-6.pl
Normal file
11
Task/FizzBuzz/Perl/fizzbuzz-6.pl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
sub fizz_buzz {
|
||||
join("\n", map {
|
||||
sub mult {$_ % shift == 0};
|
||||
my @out;
|
||||
if (mult 3) { push @out, "Fizz"; }
|
||||
if (mult 5) { push @out, "Buzz"; }
|
||||
if (!@out) {push @out, $_; }
|
||||
join('', @out);
|
||||
} (1..100))."\n";
|
||||
}
|
||||
print fizz_buzz;
|
||||
6
Task/FizzBuzz/Perl/fizzbuzz-7.pl
Normal file
6
Task/FizzBuzz/Perl/fizzbuzz-7.pl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
@FB1 = (1..100);
|
||||
@FB2 = map{!($_%3 or $_%5)?'FizzBuzz': $_}@FB1;
|
||||
@FB3 = map{(/\d/ and !($_%3))?'Fizz': $_}@FB2;
|
||||
@FB4 = map{(/\d/ and !($_%5))?'Buzz': $_}@FB3;
|
||||
@FB5 = map{$_."\n"}@FB4;
|
||||
print @FB5;
|
||||
Loading…
Add table
Add a link
Reference in a new issue