Leap.pm (408B) - raw
1 # Declare package 'Leap' 2 package Leap; 3 use strict; 4 use warnings; 5 use Exporter qw<import>; 6 our @EXPORT_OK = qw<is_leap_year>; 7 8 sub is_leap_year { 9 my ($year) = @_; 10 return 0 if $year % 4; # year is not divisible by 4 11 return 1 if $year % 100; # year is divisible by 4 but not 100 12 return 0 if $year % 400; # year is divisible by 4 and 100 but not 400 13 return 1; # divisible by 400 14 } 15 16 1;