in reply to Fast way to validate dates

Here is a slightly goofy proof of concept in another direction.

use Date::Calc qw( check_date ); while ( <DATA> ) { chomp; my @date = ( /(\d+)/g )[2,0,1]; print and print check_date(@date) ? "-->Yep\n" : "-->Nope\n"; } __END__ 1.1.1 6/4/1989 2-29-2000 2/29/2001

I don't know how it compares to strptime but Date::Calc is extremely fast so if it's important, it might be worth benchmarking. Correctly rearranging the DMY and accounting for YYYY (e.g., I believe /01 would be interpreted as 1 CE) would be part of the implementation as DC only accepts Y{1,4}, M?M, D?D.