Here are some date diff functions I find useful.
You need Date::Calc for the script below to work.
It's available on CPAN, or, if you are on FreeBSD, as the port /usr/ports/devel/p5-Date-Calc.
If you need even more date functions, have a look at the bigger Date::Manip module, also available on CPAN, and as the FreeBSD port /usr/ports/devel/p5-Date-Manip.