sub getCurrentYear() { return (localtime)[5] + 1900; }Or slightly less compactly:
sub getCurrentYear() { my(@tm) = localtime(time()); return $tm[5] + 1900; }Example use:
my $year = getCurrentYear(); print "year=$year\n";
sub getCurrentYear() { return (localtime)[5] + 1900; }Or slightly less compactly:
sub getCurrentYear() { my(@tm) = localtime(time()); return $tm[5] + 1900; }Example use:
my $year = getCurrentYear(); print "year=$year\n";