Help for this page

Select Code to Download


  1. 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
    }
    
  2. or download this
    not $year % 4 xor $year % 100 xor $year % 400;
    
  3. 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