I have created a file argument.pl which takes several arguments first of which should be in form of a year For example: 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 fills $Year
with "current year" if $ARGV[0]
is null or doesn't exist.
What do I use 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.)?