Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

How do I convert ( ' ) into something Prolog's name/2 can handle, e.g. ( \' )?

by Zombie eubios (Initiate)
on Oct 17, 2001 at 05:03 UTC ( #119303=perlquestion: print w/replies, xml ) Need Help??
Zombie eubios has asked for the wisdom of the Perl Monks concerning the following question:

In other words, how do I convert single quotes into escaped single quotes?
  • Comment on How do I convert ( ' ) into something Prolog's name/2 can handle, e.g. ( \' )?

Replies are listed 'Best First'.
Re: How do I convert ( ' ) into something Prolog's name/2 can handle, e.g. ( \' )?
by MrNobo1024 (Hermit) on Oct 17, 2001 at 07:56 UTC
    Just use a substitution regex:
    $str =~ s|'|\\'|g;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://119303]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2017-10-20 08:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (259 votes). Check out past polls.

    Notices?