Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Escaping characters in one-liners

by mrpeabody (Friar)
on Mar 12, 2005 at 18:19 UTC ( #438967=note: print w/ replies, xml ) Need Help??


in reply to Escaping characters in one-liners

On all platforms, you can avoid using particular quoting characters inside your program by using the generic quoting constructs q() and qq().

For instance, to single-quote something in bash:

perl -we'my $c=400; print q(not interpolated: $c)'

This is even more useful in Win32, where you need to avoid the much more common doublequotes:

perl -we"my $c=400; print qq(interpolated: $c)"

You can also delimit on something besides parentheses, but parens are easy to read and not disallowed by anything, so I rarely bother.

See perlop under q/STRING/.


Comment on Re: Escaping characters in one-liners
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2015-07-31 03:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls