CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Escaping the Backslash

 



ACtheMadScripter
Deleted

Sep 12, 2000, 8:23 AM

Post #1 of 2 (494 views)
Escaping the Backslash Can't Post

I need to escape a backslash(metacharecter)

ie.

print " \"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b\n";

The two backslashes in the line around the %r need to be escaped cuz they need to appear in the file im appending to. Logic tells me to backslash the backslashes, but that dosent appear to work for me. Can anyone help a MAD MAN!



------------------
AC the Mad Scripter
Script long and prosper!


japhy
Enthusiast

Sep 11, 2000, 10:32 PM

Post #2 of 2 (494 views)
Re: Escaping the Backslash [In reply to] Can't Post

In

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


"foo \"blat\" bar"
</pre><HR></BLOCKQUOTE>

the backslashes are there to escape the quotes. If you want a backslash to appear, you must put one in, and backslash it:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


"foo \\\"blat\\\" bar"
</pre><HR></BLOCKQUOTE>

That would make the string appear, LITERALLY, as

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


foo \"blat\" bar
</pre><HR></BLOCKQUOTE>

------------------
Jeff "japhy" Pinyan -- accomplished author, consultant, hacker, and teacher


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives