in reply to Roll your own date validation

There is no reason to roll this code yourself. None. Use one of the many, many excellent date/time modules on CPAN. For example, if you were to use Date::Calc for this, it would go something like:
use Date::Calc qw( Days_In_Month ); if ($days > Days_In_Month($year, $month)) { # Bitch and moan }

You will need to supply the year, because February changes how many days it has, depending on the year. (It's fickle like that.)

------
We are the carpenters and bricklayers of the Information Age.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Replies are listed 'Best First'.
Re: (2) Roll your own date validation
by Skylark (Beadle) on Jan 09, 2004 at 14:50 UTC
    I totally agree with dragonchild about using Date::Calc for date checking and calculation. It greatly simplifies things, and eliminates some subtle and sometimes obscure errors (like checking leap years as above).

    (geez, repeat of
    Re: Re: Re: Re: Re: Calculating between times? :-)