From 832f97d326b25e4afed29376df24830cba0fabd8 Mon Sep 17 00:00:00 2001 From: Peter Scott Date: Sun, 16 Feb 2020 21:13:39 -0800 Subject: A bit too long for a one-liner --- challenge-048/peter-scott/perl/ch-2.pl | 13 +++++++++++++ challenge-048/peter-scott/perl/ch-2.pl~ | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100755 challenge-048/peter-scott/perl/ch-2.pl create mode 100755 challenge-048/peter-scott/perl/ch-2.pl~ diff --git a/challenge-048/peter-scott/perl/ch-2.pl b/challenge-048/peter-scott/perl/ch-2.pl new file mode 100755 index 0000000000..65f221ed2b --- /dev/null +++ b/challenge-048/peter-scott/perl/ch-2.pl @@ -0,0 +1,13 @@ +#!/usr/local/bin/perl +use 5.016; +use warnings; +use DateTime; + +my $dt=DateTime->new(year=>2000, month=>1, day=>1); +my $dt_end = DateTime->new(year=>2999,month=>12, day=> 31); +while ( DateTime->compare( $dt, $dt_end ) <= 0 ) +{ + local $_ = $dt->strftime("%m%d%Y"); + /(\d)(\d)(\d)(\d)\4\3\2\1/ and say; + $dt->add( days => 1 ); +} diff --git a/challenge-048/peter-scott/perl/ch-2.pl~ b/challenge-048/peter-scott/perl/ch-2.pl~ new file mode 100755 index 0000000000..3227b82625 --- /dev/null +++ b/challenge-048/peter-scott/perl/ch-2.pl~ @@ -0,0 +1,13 @@ +#!/usr/local/bin/perl +use 50.16;; +use warnings; +use DateTime; + +my $dt=DateTime->new(year=>2000, month=>1, day=>1); +my $dt_end = DateTime->new(year=>2999,month=>12, day=> 31); +while ( DateTime->compare( $dt, $dt_end ) <= 0 ) +{ + local $_ = $dt->strftime("%m%d%Y"); + /(\d)(\d)(\d)(\d)\4\3\2\1/ and say; + $dt->add(days => 1 ) +} -- cgit