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.

Replies are listed 'Best First'.
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.
Re: printing a single quote in a string when using -e option
by moxliukas (Curate) on Jul 24, 2003 at 06:48 UTC