当我运行以 #!/usr/bin/perl -w
开头的文件时,我收到一个错误:
syntax error at line 153, near "=~ ?"
我尝试添加“#!/bin/bash”,这个错误不是附加的,但我得到了另一个
error: "line 34: syntax error near unexpected token `('"
我的文件中的第 153 行:
($output_volume =~ ?^([\S]+).mnc?) && ($base_name = $1) ||
die "sharpen_volume failed: output volume does not appear to be"
." a minc volume.\n";
我的文件中的第 34 行:
使用 MNI::Startup qw(nocputimes);
最佳答案
$output_volume =~ ?^([\S]+).mnc?
这曾经是有效的 perl,因此可能会出现在旧代码和教学 Material 中。
来自 perlop :
In the past, the leading m in m?PATTERN? was optional, but omitting it would produce a deprecation warning. As of v5.22.0, omitting it produces a syntax error. If you encounter this construct in older code, you can just add m.
关于perl - 当我运行以 "#!/usr/bin/perl -w"开头的文件时,出现错误 : "syntax error at line 153, near "=~ ?"",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57604807/