in reply to Calculate the nearest day

Use Date::Simple. That's my favorite module for all date related operations. And my favorite for time related stuff is Time::Piece, if you ever need to go more than just date operations.

use Date::Simple; my $d = Date::Simple->today; printf "today is: %s\n", $d->day_of_week; printf "tomorrow is: %s\n", ($d + 1)->day_of_week; printf "yesterday is: %s\n", ($d - 1)->day_of_week;
-cheepy-