use Time::Local; use POSIX 'strftime'; # get today my @today = localtime; # normalise to midday @today[0 .. 2] = (0, 0, 12); # get normalised today my $today = timelocal @today; # get current day of week my $dow = (localtime($today))[6]; # get last Sunday (day 0) my $sunday = $today - (86_400 * $dow); # get Tuesday (day 2) my $tuesday = $sunday + (86_400 * 2); # print Tuesday in a nice format print strftime "Tuesday is %d %B %Y\n", localtime $tuesday;