in reply to Prior Date

++ to the suggestions above. The first rule about calculatiing dates is: Don't Do It. It's complex, and someone else has done all the work for you. Use the OS (e.g. via POSIX::mktime, which normalizes the supplied date info), or someone else's work via a CPAN module.