diff options
| author | Steven Wilson <steven1170@zoho.eu> | 2021-11-11 16:27:03 +0000 |
|---|---|---|
| committer | Steven Wilson <steven1170@zoho.eu> | 2021-11-11 16:27:03 +0000 |
| commit | 89d2a3e812050f094d3d4521982e8f416f804911 (patch) | |
| tree | 2ee26b844eabc336b30857449e9c62d5372b216b | |
| parent | 63c89ec61dbd7965ab5403340dae7fe36441592c (diff) | |
| download | perlweeklychallenge-club-89d2a3e812050f094d3d4521982e8f416f804911.tar.gz perlweeklychallenge-club-89d2a3e812050f094d3d4521982e8f416f804911.tar.bz2 perlweeklychallenge-club-89d2a3e812050f094d3d4521982e8f416f804911.zip | |
add solution week 138 task 1 in perl and blog
| -rw-r--r-- | challenge-138/steven-wilson/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-138/steven-wilson/perl/ch-1.pl | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/challenge-138/steven-wilson/blog.txt b/challenge-138/steven-wilson/blog.txt new file mode 100644 index 0000000000..11700f6fe6 --- /dev/null +++ b/challenge-138/steven-wilson/blog.txt @@ -0,0 +1 @@ +https://tilde.town/~wlsn/pwc138.html diff --git a/challenge-138/steven-wilson/perl/ch-1.pl b/challenge-138/steven-wilson/perl/ch-1.pl new file mode 100644 index 0000000000..60ba8d6960 --- /dev/null +++ b/challenge-138/steven-wilson/perl/ch-1.pl @@ -0,0 +1,31 @@ +#!/usr/bin/env perl +# Week 138 Task 1 +# Workdays + +use strict; +use warnings; +use feature qw/ say /; +use DateTime; + +my $year = $ARGV[0]; +my $dt = DateTime->new( year => $year, month => 1, day => 1 ); +my $start_day_of_week = $dt->day_of_week(); +my $is_leap_year = $dt->is_leap_year(); +my %workdays = ( + 10 => 261, + 11 => 262, + 20 => 261, + 21 => 262, + 30 => 261, + 31 => 262, + 40 => 261, + 41 => 262, + 50 => 261, + 51 => 261, + 60 => 260, + 61 => 260, + 70 => 260, + 71 => 261, +); + +say $workdays{"$start_day_of_week$is_leap_year"}; |
