in reply to How to validate the year of a date?
See the localtime page for more details.my $yearfield = get_it_from_somewhere(); my $current_year = (localtime)[5] + 1900; die "invalid number\n" unless $yearfield =~ /^\d+$/; die "invalid year\n" if $yearfield > $current_year;
_ _ _ _ (_|| | |(_|>< _|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to validate the year of a date?
by graff (Chancellor) on May 10, 2002 at 05:24 UTC |