how to identify an argument as a "Year" in PERL
- by dexter
i have created a file argument.pl
which takes several arguments first of which should be in form of a year
example of argument : 2010 23 type
here 2010 is a year
my code does something like:
use strict;
use warning
use Date::Calc qw(:all);
my ($startyear, $startmonth, $startday) = Today();
my $weekofyear = (Week_of_Year ($startyear,$startmonth,$startday))[0];
my $Year = $startyear;
...
...
if ($ARGV[0])
{
$Year = $ARGV[0];
}
here this code fill $Year with "current year" if if $ARGV[0] is null or doesn't exists
now here instead of if ($ARGV[0])
is it possible to check that the value in $ARGV[0] is a valid year (like 2010, 1976,1999 etc.)