Petri Rautakoski wrote:

I'm making a text replace and my text to search includes a metacharacter (.
The text to be searched has been stored in a scalar for example $search. The text where the search will be made has been stored for example in a scalar $text. Here is what I'm doing:


$search = "for example (this)";
$text = "looking for example (this)";
$toBeReplaced = "that";

$text =~ s|$search|$toBeReplaced|;

$text =~ s|\Q$search\E|$toBeReplaced|;


See: perldoc perlre

--
ZSDC



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to