$_ = $hour > 10 ? 0 : 60*60*24; # seconds in the day my ($mday,$mon,$year) = (localtime(time-$_))[3..5];