Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

(tye)Re: string interpolation in RE

by tye (Sage)
on Jan 05, 2002 at 03:47 UTC ( #136419=note: print w/replies, xml ) Need Help??


in reply to string interpolation in RE

\ is special to all forms of quoting in Perl except for single-quoted here-docs. If you want two \'s in Perl then you need to put in four \'s:

print '\\decs17\dq'; # prints \decs17\dq print '\\\\decs17\dq'; # prints \\decs17\dq print '\\\\decs17\\dq'; # also prints \\decs17\dq
Note that I tend to use the last version because I find that it discourages me from getting confused into thinking that \ isn't special inside of single quotes and so I'm less likely to run into the problem you just did. (:

        - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2021-10-27 11:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (91 votes). Check out past polls.

    Notices?