【发布时间】:2016-12-22 06:18:55
【问题描述】:
我需要将“cat variousFiles”的结果通过管道传输到 perl6 程序,同时要求该程序采用不同的命令行参数。 Perl6 似乎想将第一个参数作为要读取的文件。我可以重新编写我的例程,但我想使用 shell 中的管道。有办法吗?
这是我的名为 testStdInArgs.pl 的程序:
say @*ARGS;
for lines() {
say "reading ==> ", $_;
}
我想做(foo 和 bar 是参数):
cat logFile | perl6 testStdInArgs.pl foo bar
以下是错误:
[foo bar]
Earlier failure:
(HANDLED) Unable to open file 'foo'
in block <unit> at stdInArgs.pl line 2
Final error:
Type check failed in binding to $iter; expected Iterator but got Failure (Failure.new(exception...)
in block <unit> at stdInArgs.pl line 2
非常感谢
【问题讨论】: