On Feb 5, [EMAIL PROTECTED] said:

>Problem is I don't know how to escape the entire variable $value_a so that
>the . is not considered a quantifier.

You have $value_a and $value_b in the wrong place in your example.

Use \Q...\E around $value_b.

  if ($value_b =~ /\Q$value_a\E/) {
    print "true\n";
  }

Or use the quotemeta() function:

  $safe_a = quotemeta $value_a;
  if ($value_b =~ $safe_a) { ... }

See:

  perldoc -f quotemeta
  perldoc perlop (for \Q)

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to