my $today = (localtime)[6]; my $target_day = 1; # monday $target_day -= 7; # last week printf "%d days since target day\n", $today - $target_day;