【发布时间】:2015-10-09 23:37:15
【问题描述】:
我无法修复此错误...
@temp=split(/(/)/,$headerLine);
出现此错误
Unmatched ( in regex; marked by <-- HERE in m/( <-- HERE
【问题讨论】:
标签: perl syntax-error
我无法修复此错误...
@temp=split(/(/)/,$headerLine);
出现此错误
Unmatched ( in regex; marked by <-- HERE in m/( <-- HERE
【问题讨论】:
标签: perl syntax-error
使用
@temp=split(/(\/)/,$headerLine);
或
@temp=split(m&(/)&,$headerLine);
括号中的斜线会提前终止您的正则表达式。
【讨论】:
m{(/)} 甚至是 m(/)>... 取决于看起来更具可读性的内容。
您的第二个 / 字符正在终止正则表达式,因此 Perl 将您的代码解释为:
@temp=split /(/
后面是垃圾。
简单地转义文字 /:
@temp=split(/(\/)/, $headerLine)
【讨论】: