in reply to Re: Re: Subtracting Dates
in thread Subtracting Dates

Because it's not part of the standard perl distribution and I'd like to be able to distribute my code to people who don't know how/don't want to be bothered to install stuff off CPAN?

Because

my $seconds_per_day = 60 * 60 * 24; my $then = time - (14 * seconds_per_day);
is, to me, at least as readable as ehdonhon's example of using Add_Delta_YMD and doesn't pollute the namespace either?

Granted, the $seconds_per_day version takes a little extra work (remembering which indexes from (localtime($then)) you want and adding offsets to the extracted month and year if you intend to display them directly), but it's worthwhile to have more easily portable code, IMHO.

For a larger project that's likely to need other modules, sure, Date::Calc is great. But if it's the only non-core module that would be used, I don't think it's worth the hassle of making people install it when you can do the same thing using only the core language with so little extra effort.