use Date::Calc qw/check_date/; my $valid = check_date($year, $month, $day);