sub next_friday { my $now = shift || time(); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$rest) = localtime($now); my $then = (($wday-5) * 60 * 60 * 24); ($sec,$min,$hour,$mday,$mon,$year,$rest) = localtime($now - $then); $mon += 1; $year += 1900; return "$year.$mon.$mday"; }