use POSIX(); my @lt = localtime ; my $year = POSIX::strftime( '%Y', @lt ); my $month = POSIX::strftime( '%m', @lt );