|Welcome to the Monastery|
Not all days are 24*60*60 seconds long
Well the ones on the first of the month all are :)
But you're right, they aren't guaranteed to _always_ be. The easiest fix is probably to change the call to timelocal so it uses midday rather than midnight.
$m suffers from off-by-one errors
I don't think it does. The value you get from the user is in the range 1-12. We want the next month, but timelocal wants the number in the range 0-11. So we already have the correct number (except we need to do some adjustment if the month is 12). It might not be the clearest algorithm in the world, but it _is_ correct.
"The first rule of Perl club is you do not talk about