in reply to regexp matching with "\[" in the substring to be matched
Also, you can use \Q...\E to quote otherwise regex-meaningful characters. E.g.
See also quotemeta.$p = "horraen=sumsel[13])\n"; # no backslashes required $m = qr/\Qsumsel[13]\E/; # actually in this case qr/\Qsumsel[13]/ is +enough print $p; if ( $p =~ /$m\)/ ) { print "yeah!\n"; } else { print "why isn't it matching?\n"; } __END__ horraen=sumsel[13]) yeah!
the lowliest monk
|
|---|