Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello!:)
How do I check that a given date is valid which in this case means that the format is YYYY-MM-DD..?
Thaks...

Replies are listed 'Best First'.
Re: checking dates
by naChoZ (Curate) on Sep 16, 2003 at 13:44 UTC
Re: checking dates
by hardburn (Abbot) on Sep 16, 2003 at 13:40 UTC
    my ($year, $month, $day) = $date =~ /\A (\d{4}) - (\d\d) - (\d\d) \z/x +;

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    Note: All code is untested, unless otherwise stated