in reply to
You should really think about using Date::Calc and/or Date::Manip. These might be overkill for this particular task but are lifesavers if you have to do anything else with dates.
You could also look at Time::Local which does the opposite of localtime
another (inelegant) solution would be to take the time() and add the seconds to get to the proper date from today
localtime(time() + (60 * 60 * 24 * 4) + (60 * 60 * 24 * $days)) # add
localtime(time() - (60 * 60 * 24 * 7) + (60 * 60 * 24 * $days)) # subt
+ract 1 week
Just me, the boy and these two monks, no questions asked.|