小编Mah*_*van的帖子

"连续两个术语"错误

我正在尝试编写如下的紧凑行,代码是脚本的摘录,该脚本使用动态范围的特殊变量$*IN读取STDIN.你能告诉我如何正确写这条线吗?

这有效

for $*IN.lines() {
    last when "" ;
    say "VERBOSE \"$_ is the string\"";
    $i=$i+1;
}
Run Code Online (Sandbox Code Playgroud)

不起作用

.say "VERBOSE \"$_ is the string\"" for $*IN.lines() last when "";
Run Code Online (Sandbox Code Playgroud)

错误输出:

===SORRY!=== Error while compiling /usr/share/asterisk/agi-bin/agi-t1.p6
Two terms in a row
at /usr/share/asterisk/agi-bin/agi-t1.p6:5
------> .say? "Verbose \"$_\"" for $*IN.lines() last
expecting any of:
  infix
  infix stopper
  statement end
  statement modifier
  statement modifier loop
Run Code Online (Sandbox Code Playgroud)

compiler-errors syntax-error perl6

7
推荐指数
1
解决办法
135
查看次数

标签 统计

compiler-errors ×1

perl6 ×1

syntax-error ×1