Perl + localtime()

ok here is a perl date question not asked befor.

i know i am feeling small for not knowing. BUT!!!!

$ENV{TZ}="US/Central";
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime();

how can i do the addition to year so i can get the current year w/o going $ntime=$year+1900; AND without useing the system function to call the external date program.

for somereason i cant get it to add 1900 to the year unless i create a new variable.

What do i need it for? to fill in this variable w/ the current full 4 digit year (2003).

$ARCHIVE_OUT="/homes/archive/outbound/${year}_${mon}_${mday}";

Is this it? Or did I miss your requirement?

perl -e '$ENV{TZ}="US/Central";
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime();
$ARCHIVE_OUT = sprintf("/homes/archive/outbound/%4d_%02d_%02d", $year+1900, $mon + 1, $mday);

Notice the "%02d" for $mon and $mday --- I find it convenient for all date-named files to be the same length, e.g., they will sort properly.

Also notice the $mon+1 --- localtime() numbers months starting at 0 for January.

$year+= 1900;

would add it to year without a new variable also.

sweetness. I opt for criglerj way. i found it will work best w/ the final solution.

but thanks for the quick responses guys n gals.