⭐ in reply to How do I validate a date?
There are a couple ways to do this. The best that
comes to mind is to grab a module for it (I prefer
Date::Calc personally). You could then do
something like
A non-modular way to accomplish this would be to create an array of month lengths, i.e.unless(check_date(param('year'), param('month'), param('day')) { # do something }
which would require one additional check for leap-year.my @month_lengths = (31, 28, 31, 30, ......);
|
---|
In Section
Seekers of Perl Wisdom