$year =~ # assign var $year to the result of this regexs/ # search at replace the $year var\d\d # first two digits(\d\d) # save the next two digits (the "( )" means "save")/$1/ # replace $year with the first thing I saved
use Time::Local;
#!.....iwperl -w...my @tm = localtime();$tm[5] += 1900;$tm[4] += 1;# format as DD-MM-YYYY [US-centric]$formatted_date = sprintf("%02d.%02d.%4d", @tm[3..5]);# format as MM-DD-YYYY [European-centric]$formatted_date = sprintf("%02d.%02d.%4d", @tm[4,3,5]);# format in universal date format YYYY-MM-DD$formatted_date = sprintf("%4d-%02d-%02d", @tm[5,4,3]); ...