Not really the way to check a date, it's already a lot of code and still far from being correct. Use appropriate module:
use 5.010; use strict; use warnings; use DateTime::Format::Strptime; my $strp = DateTime::Format::Strptime->new( pattern => '%m/%d/%Y %H:%M +', ); while (<DATA>) { chomp; my $dt = $strp->parse_datetime($_); if ($dt) { say "Parsed: $dt"; } else { say "Invalid date: $_"; } } __DATA__ 2/21/2012 fjfjf 97609876 afadfa 0/0/2012 99:00 1/0/2012 99:00 02/31/2012 01:55 02/21/2012 01:55
In reply to Re^2: catching incorrect input type
by zwon
in thread catching incorrect input type
by brayk1990
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |