From 45fce56e0db6a1ba2e639766439cf416136c0929 Mon Sep 17 00:00:00 2001 From: Abigail Date: Sun, 14 Nov 2021 21:41:18 +0100 Subject: Use defaults --- challenge-138/abigail/perl/ch-1.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/challenge-138/abigail/perl/ch-1.pl b/challenge-138/abigail/perl/ch-1.pl index d2667e6131..9f67cdf720 100644 --- a/challenge-138/abigail/perl/ch-1.pl +++ b/challenge-138/abigail/perl/ch-1.pl @@ -71,7 +71,7 @@ my $SATURDAY = 6; # Given a year, return its "Doomsday" value. # 0 -> Sunday, 6 -> Saturday # -sub doomsday ($year) { +sub doomsday ($year = $_) { use integer; my $anchor = ($TUESDAY, $SUNDAY, $FRIDAY, $WEDNESDAY) [($year / 100) % 4]; my $y = $year % 100; @@ -79,11 +79,11 @@ sub doomsday ($year) { $doomsday; } -sub is_leap ($year) { +sub is_leap ($year = $_) { ($year % 400 == 0) || ($year % 4 == 0) && ($year % 100 != 0) ? 1 : 0 } while (<>) { - say $lookup [is_leap $_] [doomsday $_] + say $lookup [is_leap] [doomsday] } -- cgit