my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdt) = localtime(time); my $weekofyear=0; #first week is first sunday, 0 == lastyear; if ($yday>=$wday) { #into the first week $weekofyear=int(($yday-$wday)/7)+1; #normalize to sunday }