From: "Jason Rauer" <[EMAIL PROTECTED]>
> Say I have:
> 
> foreach $string (@strings) {
>   if ($text =~ /$string/) { ... }
> }
> 
> Now, it happens that the data in $string contains \|()[{$^*.? etc.
> that turn into regex metacharacters within m// but I want to match
> them by their literal value, not as a regex pattern. That is, now Perl
> terminates the script because whenever $string happens to contain,
> say, a ( it interprets it as an unmatched parenthesis in a regex
> pattern when what I'd like to match is just \(.
> 
> How to keep those characters from turning into regex patterns?

Maybe you should not be using regexps at all.See
        perldoc -f index

HTH, Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


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

Reply via email to