[英]Storing output of perl script to a file
I"m calling a perl script stored in one PC, for example with name machine1 from say machine2 using the command: 我正在使用以下命令调用存储在一台PC中的perl脚本,例如,使用诸如machine2之类的名称为machine1:
system("perl /CC/builds/123.pl\n");
Now, i need to get the log of the whole perl file executed to be stored in a say 123.txt file and created on machine1.Can any text file be opened in the perl file at the beginning which stored only output of the line executed? 现在,我需要获取执行的整个Perl文件的日志以存储在一个123.txt文件中并在machine1上创建。可以在开头的perl文件中打开任何文本文件,该文件仅存储执行的行的输出? Please help.
请帮忙。
Thanks, Ramki 谢谢,Ramki
I'm quite new on that and I don't know if I am understanding your question, but why you don't use "backticks" instead of "system"? 我对此很陌生,不知道我是否理解您的问题,但是为什么您不使用“反引号”而不是“系统”呢? It would let you store the output in a variable and then you can do with this variable whatever you want.
它将使您将输出存储在变量中,然后可以使用此变量进行任何操作。
About backticks: What's the difference between Perl's backticks, system, and exec? 关于反引号: Perl的反引号,系统和exec有什么区别?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.