On Thu, 18 Sep 2003, Syamala Tadigadapa wrote:

> Here is a simple solution (unless you  are bent on doing it in a longer way
> using a date time class.)

Yeah, because letting others do the repeated work for you would be silly.

> sub jan1{
>   my $y =  shift;
>   my $m = 1; $d = 1;
>   $m = 11; $y--;
>   my $c = int($y / 100); $yy = $y %100;
>   my $z = ( 1 + $yy + int($yy/4) + int($c/4) - 2*$c) % 7;
>   $z += 7 if $z < 0;
>   return $z;   # 0 ==> Sun day.  6 ==> Sat. day.
> }

Into how many projects will you copy this code?  And it's not even
well-factored!  At least take the leap year part and put it in a separate
subroutine.  Or let me guess, that'd decrease performance too much?


-dave

/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/

Reply via email to