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

printing a single quote in a string when using -e option

by yossarian (Novice)
on Jul 24, 2003 at 06:41 UTC ( #277449=perlquestion: print w/ replies, xml ) Need Help??
yossarian has asked for the wisdom of the Perl Monks concerning the following question:

Nameste monks,
Here is newbie question that I am hoping a more enlightened monk can provide some guidance on: What are some ways that a single quote can be printed as part of a string using the print function when using the -e option.  print " \' " works as I want it to when part of a .pl file, but  perl -e 'print "\'"' and any variants that I have come up with so far don't and I'm unsure of the way to get around this. thanks.

Comment on printing a single quote in a string when using -e option
Select or Download Code
Re: printing a single quote in a string when using -e option
by moxliukas (Curate) on Jul 24, 2003 at 06:48 UTC
Re: printing a single quote in a string when using -e option
by yossarian (Novice) on Jul 24, 2003 at 07:30 UTC
    Thanks. I received several helpful answers, all of them different, but all of them valid. Here's a listing of the various ways if anyone is interested:
     perl -e "print '\''"
     perl -e'print "\047"'
     perl -e "print q{'}"
    Also, I'm now aware that there is a section related to quoting in perldoc perlop.
    Thanks - yossarian.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2014-09-17 22:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (100 votes), past polls