aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2019-10-18 11:24:11 +0100
committerGitHub <noreply@github.com>2019-10-18 11:24:11 +0100
commit345a40224f4226feecbf4df13c0f76410d7f5d05 (patch)
tree9ddc90301e9c8e97329d8900ecae3c2323a7def6
parentbdaee85f1476feedc6f7880941320784ac6ac81c (diff)
parentad68e9e4012a134f307bd5d8c59249b8e66d4ab1 (diff)
downloadperlweeklychallenge-club-345a40224f4226feecbf4df13c0f76410d7f5d05.tar.gz
perlweeklychallenge-club-345a40224f4226feecbf4df13c0f76410d7f5d05.tar.bz2
perlweeklychallenge-club-345a40224f4226feecbf4df13c0f76410d7f5d05.zip
Merge pull request #792 from 4RandR/master
add solutions
-rw-r--r--challenge-030/vyacheslav-volgarev/perl5/ch-1.pl14
-rw-r--r--challenge-030/vyacheslav-volgarev/perl5/ch-2.pl16
2 files changed, 30 insertions, 0 deletions
diff --git a/challenge-030/vyacheslav-volgarev/perl5/ch-1.pl b/challenge-030/vyacheslav-volgarev/perl5/ch-1.pl
new file mode 100644
index 0000000000..c677a4a685
--- /dev/null
+++ b/challenge-030/vyacheslav-volgarev/perl5/ch-1.pl
@@ -0,0 +1,14 @@
+use strict;
+use warnings;
+use v5.10;
+
+use constant {
+ Sunday => 0,
+ Wednesday => 3
+};
+
+my $day = Wednesday;
+
+for ( 2020.. 2100 ) {
+ say "25 Dec $_ is Sunday" if ( $day += $_ % 4 != 0 || ($_ % 100 == 0 && $_ % 400 != 0) ? 1 : 2 ) % 7 == Sunday;
+}
diff --git a/challenge-030/vyacheslav-volgarev/perl5/ch-2.pl b/challenge-030/vyacheslav-volgarev/perl5/ch-2.pl
new file mode 100644
index 0000000000..978846d43a
--- /dev/null
+++ b/challenge-030/vyacheslav-volgarev/perl5/ch-2.pl
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+use v5.10;
+
+my @numbers;
+
+for my $first ( 1..10 ) {
+
+ for my $second (1..10) {
+ my $third = 12 - $first - $second;
+ push @numbers, join ", ", sort ( $first, $second, $third ) if $third > 0;
+ }
+}
+my %uniq;
+$, = ";\n";
+say sort grep !$uniq{$_}++, @numbers;