From 7a6aa813658b4d3671d1a2e9b341790ca198693f Mon Sep 17 00:00:00 2001 From: robbie-hatley Date: Sun, 8 Oct 2023 13:34:34 -0700 Subject: Fixed some errors. --- challenge-237/robbie-hatley/perl/ch-1.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge-237/robbie-hatley/perl/ch-1.pl b/challenge-237/robbie-hatley/perl/ch-1.pl index 87b0c6968b..affadb080c 100755 --- a/challenge-237/robbie-hatley/perl/ch-1.pl +++ b/challenge-237/robbie-hatley/perl/ch-1.pl @@ -98,7 +98,7 @@ sub is_leap_year ($year) { sub days_per_month ($year, $month) { state @dpm = (31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); - if ( 2 == $month ) { return (is_leap_year($year) ? 29 : 28);} + if ( 1 == $month ) { return (is_leap_year($year) ? 29 : 28);} else {return $dpm[$month];} } # end sub days_per_month -- cgit From 3f124f4379aff072e6cb01b9a18dc174d3b924da Mon Sep 17 00:00:00 2001 From: robbie-hatley Date: Sun, 8 Oct 2023 14:12:54 -0700 Subject: Simplified sub days_per_month --- challenge-237/robbie-hatley/perl/ch-1.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/challenge-237/robbie-hatley/perl/ch-1.pl b/challenge-237/robbie-hatley/perl/ch-1.pl index affadb080c..718b5d6635 100755 --- a/challenge-237/robbie-hatley/perl/ch-1.pl +++ b/challenge-237/robbie-hatley/perl/ch-1.pl @@ -98,8 +98,8 @@ sub is_leap_year ($year) { sub days_per_month ($year, $month) { state @dpm = (31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); - if ( 1 == $month ) { return (is_leap_year($year) ? 29 : 28);} - else {return $dpm[$month];} + if ( is_leap_year($year) ) {$dpm[1]=29} else {$dpm[1]=28} + return $dpm[$month]; } # end sub days_per_month sub suffix ($x) { -- cgit