aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-030/rage311/perl5/ch-1.pl14
-rw-r--r--challenge-030/rage311/perl5/ch-2.pl19
2 files changed, 33 insertions, 0 deletions
diff --git a/challenge-030/rage311/perl5/ch-1.pl b/challenge-030/rage311/perl5/ch-1.pl
new file mode 100644
index 0000000000..4e53aaf585
--- /dev/null
+++ b/challenge-030/rage311/perl5/ch-1.pl
@@ -0,0 +1,14 @@
+#!/usr/bin/env perl
+
+use 5.030;
+use strict;
+use warnings;
+
+use Time::Piece;
+
+say for grep { Time::Piece->strptime("$_-12-25", '%Y-%m-%d')->wday == 1 } 2019..2100;
+
+
+__DATA__
+Write a script to list dates for Sunday Christmas between 2019 and 2100. For example, 25 Dec 2022 is Sunday.
+
diff --git a/challenge-030/rage311/perl5/ch-2.pl b/challenge-030/rage311/perl5/ch-2.pl
new file mode 100644
index 0000000000..b1a3f463c4
--- /dev/null
+++ b/challenge-030/rage311/perl5/ch-2.pl
@@ -0,0 +1,19 @@
+#!/usr/bin/env perl
+
+use 5.030;
+use strict;
+use warnings;
+
+my %solutions;
+
+for my $i (1..11) {
+ for my $j (1..11) {
+ for my $k (1..11) {
+ $solutions{join ',', sort $i, $j, $k}++ if
+ (!($i % 2) || !($j % 2) || !($k % 2)) && $i + $j + $k == 12;
+ }
+ }
+}
+
+say join "\n", sort keys %solutions;
+