Rob Dixon wrote:

>> > I'm having problems....due (i suppose) to the special chars in the
>> > $var1 string the s/// don't match anything.
>> > What can I do to?
>>
>> s{\Q$var1\E}{$var2} is usually what you want, except that may very
>> well 'quote' out the $ in $var.
> 
> I guess you mean $var2? The replacement expression will
> only be interpolated once. Any variable names embedded in the
> contents of $var2 will be copied verbatim.

no, I meant $var1 there 

>> I suspect what you really want is
>>
>> $var1 = qr{roger? what the @*$!};
> 
> This won't work, I'm afraid. The $! will be interpolated
> unless the delimiters are single-quotes:

oh duh. That's what I get for not *(testing testing testing)* before I 
posted. :-P bleah. thanks for pointing that out. :)
 
>     print (my $var1 = qr{roger? what the @*$!});
> 
> output
> 
>     (?-xism:roger? what the @*)
> 
>> ( perldoc -f qr ) (perldoc perlre) and (perldoc perlop) for more
>> details.
> 
> Maybe what is wanted is:
> 
>     $var1 = quotemeta q{roger? what the @*$!};
> 
> which is the equivalent of the \Q...\E construct, but
> applicable to an existing string.
> 
> HTH,
> 
> Rob


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

Reply via email to