On Thu, Jul 12, 2001 at 10:27:00AM -0400, Brad Ummer wrote:

> >Use quotemeta() or \Q\E instead:
> >
> >if ($db_string =~ /\Q$web_string/) {
> >  print "Match!\n";
> >}

> Exactly what I was looking for.  Thank you.  Now, just a question of
> usage- are quotemeta() and \Q\E exchangeable? Also, if I use \Q, is it
> important to close it with a \E, or if the entire string needs to be
> quoted, can I just leave it open (as you did)?  Thanks again.

Yup, quotemeta() and \Q have the same effect.  Any non-word character gets
a backslash inserted before it.  \Q just lets you interpolate this effect
into a string.

\E is optional at the end of the string, but you can put it there if you
want to be explicit.


Ronald

Reply via email to