- or download this
sub isleap {
my ($year) = @_;
...
return 1 if (( $year % 4 ) == 0 ); # All other 4's are leap
return 0; # Everything else is not
}
- or download this
not $year % 4 xor $year % 100 xor $year % 400;
- or download this
print $_,
((not $_ % 4 xor $_ % 100 xor $_ % 400)
...
2000 is a leap year
2004 is a leap year
2100 is not a leap year