On Thu, Feb 07, 2002 at 12:19:01AM -0500, Bill -OSX- Jones wrote:
> Hi :)
> 
> I was asked recently if I could write a Perl program that
> would find out when the next time Christmas day would
> actually be on a Sunday.

    use Date::Christmas qw(christmasday);
    my $year = (localtime)[5] + 1900;
    1 until christmasday($year++) eq 'Sunday';
    print "Christmas will fall on a Sunday in $year\n";

The man page has the algorithm.


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl Quality Assurance      <[EMAIL PROTECTED]>         Kwalitee Is Job One
I SEE A RED ASS AND I WANT TO PASTE IT BLACK
WON'T OPEN ANYMORE I PASTED UP THE CRACK
        -- swansong

Reply via email to