diff options
| -rwxr-xr-x | challenge-030/daniel-mita/perl5/ch-1.pl | 12 | ||||
| -rwxr-xr-x | challenge-030/daniel-mita/perl6/ch-1.p6 | 28 | ||||
| -rwxr-xr-x | challenge-030/daniel-mita/perl6/ch-2.p6 | 6 |
3 files changed, 46 insertions, 0 deletions
diff --git a/challenge-030/daniel-mita/perl5/ch-1.pl b/challenge-030/daniel-mita/perl5/ch-1.pl new file mode 100755 index 0000000000..4660a3a4be --- /dev/null +++ b/challenge-030/daniel-mita/perl5/ch-1.pl @@ -0,0 +1,12 @@ +#!/usr/bin/env perl +use 5.012; +use warnings; + +use Time::Piece; + +my $t = Time::Piece->strptime('2019-12-25', '%F'); + +until ($t->year > 2100) { + say $t->ymd if $t->day eq 'Sun'; + $t = $t->add_years(1); +} diff --git a/challenge-030/daniel-mita/perl6/ch-1.p6 b/challenge-030/daniel-mita/perl6/ch-1.p6 new file mode 100755 index 0000000000..bb55c9e4cb --- /dev/null +++ b/challenge-030/daniel-mita/perl6/ch-1.p6 @@ -0,0 +1,28 @@ +#!/usr/bin/env perl6 +use v6; + +enum Days « + :1Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + Sunday +»; + +sub MAIN (Bool :$extra) { + my @extra = "\nExtra:"; + + for 2019 .. 2100 -> $year { + given Date.new( :$year, :12month, :25day ) { + if .day-of-week == 7 { .say } + when $extra { push @extra, "$_ is {Days(.day-of-week)}" } + } + } + + # I misread the task at first but decided to keep the code for it + if $extra { + .say for @extra; + } +} diff --git a/challenge-030/daniel-mita/perl6/ch-2.p6 b/challenge-030/daniel-mita/perl6/ch-2.p6 new file mode 100755 index 0000000000..84de4a0008 --- /dev/null +++ b/challenge-030/daniel-mita/perl6/ch-2.p6 @@ -0,0 +1,6 @@ +#!/usr/bin/env perl6 +use v6; + +for [X] (1..12) xx 3 { + .fmt('%2u', '|').say when .sum == 12 && .any %% 2; +} |
