Joel Gwynn wrote:
> my $string = "abc";
> my $match = "ab(c";
> 
> if($string =~ m/$match/){ print "MATCH!\n"; }
> 
> This leads me to consider the many other characters that would need
> escaping.

If $match is always going to be treated as a plain string, and that's 
the extent of your RE, then perhaps you don't need to use an RE match at 
all. Consider simply doing:

   if ($string eq $match) {print "MATCH!\n";}

or if a sub-string match is desired:

   if (index($string,$match) != -1) {print "MATCH!\n";}

which is faster than an RE too, but less readable, so I wouldn't 
generally recommend it.

  -Tom

-- 
Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile: https://www.linkedin.com/e/fps/3452158/
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to