List Info

Thread: Substitute a single-quote syntax




Substitute a single-quote syntax
user name
2007-02-01 09:10:23
I would like to know the correct syntax to allow me to
substitute an 
apostrophe (or single-quote) with a backslash prefix. 

The following code

s/(')/\'/g;

comments all the subsequent code until the next single-quote

character appears.

The following code does what I want, but relies on using a
memory 
variable

s/(')/\$1/g;

Thanks



Unsubscribing info is here: h
ttp://help.yahoo.com/help/us/groups/groups-32.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://g
roups.yahoo.com/group/perl-beginner/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http
://groups.yahoo.com/group/perl-beginner/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:perl-beginner-digest@yahoogroups.com 
    mailto:perl-beginner-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    perl-beginner-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

Re: Substitute a single-quote syntax
user name
2007-02-01 14:52:11
--- In perl-beginner@yahoogroups.com, "hooyar66"
<pcbcad...> wrote:
>
> I would like to know the correct syntax to allow me to
substitute 
an 
> apostrophe (or single-quote) with a backslash prefix. 
> 
> The following code
> 
> s/(')/\'/g;
> 
> comments all the subsequent code until the next
single-quote 
> character appears.
> 
> The following code does what I want, but relies on
using a memory 
> variable
> 
> s/(')/\$1/g;
> 
> Thanks
>

This:

/(')/\'/g;

Should read:

/'/\'/g;


Removed the unnecessary paretheses.

Any ideas?

NJH



Unsubscribing info is here: h
ttp://help.yahoo.com/help/us/groups/groups-32.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://g
roups.yahoo.com/group/perl-beginner/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http
://groups.yahoo.com/group/perl-beginner/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:perl-beginner-digest@yahoogroups.com 
    mailto:perl-beginner-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    perl-beginner-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )