diff options
| author | Jaime <42359730+bracteatus@users.noreply.github.com> | 2019-08-01 10:02:17 -0600 |
|---|---|---|
| committer | Jaime <42359730+bracteatus@users.noreply.github.com> | 2019-08-01 10:02:17 -0600 |
| commit | 36d969bf392d2c2464dd30aec1868d5326abf4ad (patch) | |
| tree | 061f8e8ac7562cbf4a3d909d4f63a1f92c2ed2cc /challenge-019 | |
| parent | 1e6c14f2f8739e1c4c6e2a9a1419fa4b890e2135 (diff) | |
| download | perlweeklychallenge-club-36d969bf392d2c2464dd30aec1868d5326abf4ad.tar.gz perlweeklychallenge-club-36d969bf392d2c2464dd30aec1868d5326abf4ad.tar.bz2 perlweeklychallenge-club-36d969bf392d2c2464dd30aec1868d5326abf4ad.zip | |
Use `cal` subprogram.
Diffstat (limited to 'challenge-019')
| -rw-r--r-- | challenge-019/jaime/perl5/ch-1.pl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-019/jaime/perl5/ch-1.pl b/challenge-019/jaime/perl5/ch-1.pl new file mode 100644 index 0000000000..6f59f1dccd --- /dev/null +++ b/challenge-019/jaime/perl5/ch-1.pl @@ -0,0 +1,13 @@ +# # Task #1 +# +# Write a script to display months from the year 1900 to 2019 where you +# find 5 weekends i.e. 5 Friday, 5 Saturday and 5 Sunday. + +for my $year (1900..2019) { + for my $month (1, 3, 5, 7, 8, 10, 12) { + # print months with 31 days that start on a Friday. + if `cal -h -m $month $year | tail -n 6` =~ /^\h+1\h+2\h*\v/; { + print `cal -h -m $month $year`; + } + } +} |
