Re: perl leap year function?
-----BEGIN PGP SIGNED MESSAGE-----
On Wed, 1 Sep 1999, Aaron Van Couwenberghe wrote:
> I need an algorithm that can match a number of days with any month. For
> this to be useful, I need a function that can tell me if it's a leap year
> this year.
Just throwing one more subroutine onto the fire... It doesn't work with
years before 0, and IIRC it'll go wrong in 5048 or whenever the next
adjustment is needed.
my $year=shift || die "&isLeapYear needs a year as input!\n";
$year =~ /^\d/ || die "&isLeapYear needs a number as input!\n";
$year % 400 or return 1;
$year % 100 or return 0;
$year % 4 or return 1;
finger for PGP public key.
-----BEGIN PGP SIGNATURE-----
-----END PGP SIGNATURE-----