Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
if ($_ =~ "buff\)" ) { print $_ ; }
执行上述行时,Perl 抛出以下错误:
Unmatched ) in regex; marked by <-- HERE in m/buff)
任何人都可以解释为什么这个)右括号不能像正常字符串一样工作,即使我用反斜杠转义它?
)
转义反斜杠:
=~ "buff\\)"
或者根本不使用引号,而是使用正则表达式:
=~ /buff\)/