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

(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?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://136419]
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
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (91 votes). Check out past polls.