[Perl]谁能解释一下:`date +'%y%m%d`
my $today = `date +'%y%m%d`;
chop $today;
谁能帮解释一下第一句,前后那两个(`)引号是何意思?
在Perl的语法里起何作用?
[解决办法]
执行命令,并将命令标准输出作为结果返回。貌似其等同于 qx/date + '%y%m%d'/
qx/STRING/
`STRING`
A string which is (possibly) interpolated and then executed as a system command with /bin/sh or its equivalent. Shell wildcards, pipes, and redirections will be honored. The collected standard output of the command is returned; standard error is unaffected. In scalar context, it comes back as a single (potentially multi-line) string, or undef if the command failed. In list context, returns a list of lines (however you've defined lines with $/ or $INPUT_RECORD_SEPARATOR), or an empty list if the command failed.
[解决办法]
反引号表示把反引号里面的内容作为系统命令执行,并把结果返回
[解决办法]
这个是 unix/linux 下的命令 date,不是微软的东东
[解决办法]