Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Escaping multiple escape chars

by Roy Johnson (Monsignor)
on Dec 09, 2005 at 20:42 UTC ( [id://515647]=note: print w/replies, xml ) Need Help??


in reply to Escaping multiple escape chars

Backslash is a special character. When you assign
$txt = ' __\\U//__ ';
, the first backslash is escaping the second, so the string has only one backslash in it. Print it and you'll see. When something other than a backslash or quote character appears after the backslash, the backslash isn't seen as an escape, and is interpreted literally. So your
$txt = ' \*/ ';
also has one backslash.

Backslash is also special in the replacement side of the s///, so your four become two. To convert one to four, double the number of backslashes on the right.


Caution: Contents may have been coded under pressure.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://515647]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-04-20 05:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found