+ -
当前位置:首页 → 问答吧 → 如何在PERL文件中执行PERL命令

如何在PERL文件中执行PERL命令

时间:2010-10-18

来源:互联网

如要执行以下这条命令
perl -ne 'print "test\n" if $.==3;print;' 200800117_haha_abc_flow

作者: ztj2247   发布时间: 2010-10-18

lz最好把问题表达清楚点。

作者: 兰花仙子   发布时间: 2010-10-18

_haha_abc_flow 还没搞定啊,是不是要用 eval 啊?去置顶看看提问的智慧吧

作者: zhlong8   发布时间: 2010-10-18



QUOTE:
lz最好把问题表达清楚点。
兰花仙子 发表于 2010-10-18 19:40




    就是我要在PERL文件中 运行 perl -ne 'print "test\n" if $.==3;print;' $file[0]


Unquoted string "perl" may clash with future reserved word at ./analyse.pl line 57.
Scalar found where operator expected at ./analyse.pl line 57, near "'print "test\n" if $.==3;print;' $file"
        (Missing operator before  $file?)
syntax error at ./analyse.pl line 57, near "-ne"
Execution of ./analyse.pl aborted due to compilation errors.

作者: ztj2247   发布时间: 2010-10-18

本帖最后由 zhlong8 于 2010-10-18 20:15 编辑

system 或者 反引号``? 你也可以自己在程序里面实现 -n 的效果

作者: zhlong8   发布时间: 2010-10-18



QUOTE:
system 或者 反引号``? 你也可以自己在程序里面实现 -n 的效果
zhlong8 发表于 2010-10-18 20:14




    举个例子呀楼上

作者: ztj2247   发布时间: 2010-10-18

作者: zhlong8   发布时间: 2010-10-18