两种perl中调用系统命令的不同处

#!/usr/bin/perl

$tmp=”20080418a”;

$tmp2=`date +\%Y\%m\%d`;
print “$tmp2″;
print “$tmp2″;
print “$tmp\n”;

20080418
20080418
20080418a
此时$tmp2为 20080418(包含回车)

=================

#!/usr/bin/perl

$tmp=”20080418a”;

$tmp2=system(”date +\%Y\%m\%d”);
print “$tmp2″;
print “$tmp2″;
print “$tmp\n”;

20080418
0020080418a
此时$tmp2为0 20080418为date +\%Y\%m\%d显示

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*


为了防止恶意的垃圾评论脚本,请输入以下图片里面的数学方程式的答案。
防垃圾评论问题