Hi Syamala,
> Here is a simple solution (unless you are bent on doing
> it in a longer way using the class in ref.)
The project I have started on is using DateTime for other things, so I
figured I would use it here as well. Besides I don't think what I
wrote is doing it the long way, granted I did screw up by passing
in params to a method that was ignoring it. But I still got
what I wanted.
> sub jan1{
> my $y = shift;
> my $m = 1; $d = 1;
^^^^^^
why is that there? and I don't understand why you set $m to 1
and then set it to 11?
> $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.
>}
>sub sundays{
> my $year = shift;
> my $j1st = jan1($year);
> return 53 if $j1st == 0 || ($j1st == 6 && jan1($year+1) == 1);
> return 52;
>}
Ron Hill