sub is_leap_year { my $year = shift; # We assume that validation has taken place. if ( $year % 400 == 0 ) { return 1; } elsif ( $year % 100 == 0 ) { return 0; } elsif ( $year % 4 == 0 ) { return 1; } else { return 0; } }