Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 about the Monastery: (3)
As of 2015-07-06 04:09 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 (70 votes), past polls