简体   繁体   中英

Unmatched ) in regex; marked by <— Error in Perl

if ($_ =~ "buff\)" ) { print $_ ; }

While executing the above line, Perl is throwing following error:

Unmatched ) in regex; marked by <-- HERE in m/buff)

Can any one explain why this ) close parenthesis is not working as normal string even if I am escaping it with a backslash?

Escape the backslash:

=~ "buff\\)"

Or don't use the quotation marks at all, but regex notation:

=~ /buff\)/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM