tobold.org

correct • elegant • free

△ comp.lang.perl △

HELP: ▻

Quotes, ", ' and more ' " 's

In article <3pe050$9b1@pipe.pipex.net>, Ian Phillipps <ian@pipex.net> wrote:
>   s/'+/'"$&"'/g
>will do the trick for all the "standard" shells I know of.
>(Phrased carefully since one of my colleagues will read this and uses
>"rc", which is different...)

Now who could that be..? :-)

Quoting in rc is far simpler than in any other shell, let alone Perl.
As with sh, you want to sling single quotes around the entire program,
but any quotes already in the program just need to be doubled.  The
corresponding substitution would be

    s/'/''/g

Tim.
--
Tim Goodwin        | "X.400(84)... conformance can reduce
Public IP Exchange | real interoperability." -- Steve Kille

Original headers:

From: tim@pipex.net (Tim Goodwin)
Newsgroups: comp.lang.perl
Subject: Re: Quotes, ", ' and more ' " 's
Date: 18 May 1995 17:58:30 +0100
Organization: PIPEX, 216 Science Park, Cambridge, England
Message-ID: <3pfubm$er3@pipe.pipex.net>
References: <3pdnjo$djb@elaine14.stanford.edu> <3pe050$9b1@pipe.pipex.net>

△ comp.lang.perl △

HELP: ▻