If you are doing much date manipulation at all, you should strongly consider using one of the fine modules available:
DateTime, Date::Calc,
Date::Manip, etc.
There isn't much learning curve; most have FAQs with cut-and-paste recipes for common tasks.