in reply to Re: Re: can't get $& to remove value in a substitution
in thread can't get $& to remove value in a substitution
You can see that putting your variable between \Q and \E in the regex disables the ( and ) metacharacters in the pattern. (I think!).my $pattern = "ABC()DEF"; my $string = "ABC()DEF"; if ($string =~ /\Q$pattern\E/) { print "match 1\n" } if ($string =~ /$pattern/) { print "match 2\n" }
|
|---|