根据当前时间来创建文件夹
执行以下code 后,会在脚本所在目录下创建一个文件夹,格式如:user_xxxxxxxx_xxxxxx_hello
#!/usr/bin/perl
use strict;
sub mkdir_by_date{
#print local time
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
my $mytime = sprintf("%04d%02d%02d_%02d%02d%02d", $year+1900,$mon+1,$mday,$hour,$min,$sec);
printf("DateTime: %s", $mytime);
system("mkdir user_${mytime}_hello");
}
mkdir_by_date;