【发布时间】:2018-05-24 16:31:03
【问题描述】:
我正在尝试从文件中提取数据到 Perl 程序并使用“foreach”循环在 Linux sh 终端中执行它,但是每次 Perl 将值返回到 sh 终端时,它都会在打印下一个导致我的脚本的字符串之前打印一个新行失败。我该如何预防?
open(FILE, "input") or die("Unable to open file");
# read file into an array
@data = <FILE>;
# close file
close(FILE);
foreach my $x(@data) {
system "/granite_api.pl -type update_backdoor -project tgplp -test_id $x -turninid 4206";
}
预期输出:
/granite_api.pl -type update_backdoor -project tgplp -test_id example -turninid 4206
实际输出:
/granite_api.pl -type update_backdoor -project tgplp -test_id example
-turninid 4206
【问题讨论】: