Your leap year calculation is incorrect. 2004 is a leap year, 2000 is a leap year, 1904 is a leap year, but 1900 is NOT. The rule is:
- divisible by 4, and
- not divisible by 100, or
- divisible by 400
if (!($y % 4) and ($y % 100 or !($y % 400))) { ... }
Other than that, here's a much simpler method for finding out yesterday:
use Time::Local;
my $noon = timelocal(0,0,12, (localtime)[3,4,5]);
my ($d,$m,$y) = (localtime($noon - 86400))[3,4,5];
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;