脚本一
perl sprintdate.pl
Local Time: 20111222_150720
脚本二
#my $date=localtime;
#print "$daten";
sub GetDateToday
{
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year=$year+1900;
return $year.'-'.sprintf('%02u-%02u', $mon+1, $mday);
}
my $cur_date=GetDateToday();
print "$cur_daten";
print "$^On";
perl date.pl
2011-12-22
linux
注:$^O 表示当前系统