Paul Kraus wrote:
> 
> > From: John W. Krahn [mailto:[EMAIL PROTECTED]]
> >
> > Yes that will work although you don't need to backslash the
> > quote in the regular expression.
> >
> > $ perl -le'$_ = q[one "two" three]; s{"}{\\"}g; print'
> > one \"two\" three
> 
> Correct me if I am wrong but the only time you need to escape a
> backslash is if your regexpr is started and terminated with it. Since
> you are using {} I don't think you need to do that.

You have to backslash the backslash in this context because both sides
of the substitution are in effect, double quoted strings.  The
delimiters have no effect on this "double-quotish" property unless they
are single quotes.  s/"/\\"/g is the same as s{"}{\\"}g is the same as
s'"'\"'g



John
-- 
use Perl;
program
fulfillment

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

Reply via email to