I'm working on a perl interface to a sort of database-query program with a command-line interface, and I'm almost at my wits end trying to quote special characters in order to escape them from perl-shell-whatever. An ordinary shell script to do a query might look like this...
eval `script_to_setup_environment`
Report -raw -view fileView -where " \
   fileView.Attr1 in ('eggs') and \
   fileView.Attr2 in ('yes') and \
   fileView.Attr3 in ('blue') \
   " |
...with the pipe going to something else. Now I'm trying to place this script in a "here-document", and having a terrible time with all the double-quotes, single-quotes, newlines, and parentheses, especially since I have to be able to change the values in the single quotes inside the parentheses. Any ideas out there? I'm wearing out my backslash key to no avail. I'd love to do it all inside the perl script if it's possible. Thanks!

In reply to Save Me from quoting hell? by Jason0x21

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.