【发布时间】:2012-01-24 15:09:01
【问题描述】:
我正在尝试修改其他人编写的脚本,并且我想将我的脚本与他的脚本分开。
我编写的脚本以print 行结尾,输出所有相关数据,以空格分隔。
例如:print "$sap $stuff $more_stuff";
我想在另一个 perl 脚本的中间使用这些数据,但我不确定是否可以对我编写的脚本使用系统调用。
例如:system("./sap_calc.pl $id"); #obtain printed data from sap_calc.pl here
这可以吗?如果没有,我该怎么做?
有些相关,但不使用
system():
How can I get one Perl script to see variables in another Perl script?
【问题讨论】:
-
阅读您正在使用的函数的文档! “perldoc -f system”在第 3 段中回答了您的问题“您想使用什么来捕获命令的输出,因为您应该只使用......”
标签: perl arguments parameter-passing stdout stdin