首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

[Perl]哪位高手能解释一上:date +'%y%m%d

2013-01-07 
[Perl]谁能解释一下:`date +'%y%m%d`my $today `date +%y%m%d`chop $today谁能帮解释一下第一句

[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,不是微软的东东
[解决办法]

引用:
这个是 unix/linux 下的命令 date,不是微软的东东
初学PERL的经常遇到这种问题
[解决办法]
引用:
这个是 unix/linux 下的命令 date,不是微软的东东

++
man date 
查看说明

热点排行