Just a quick addition. Here documents have their pro and cons, and I take your point. However, one of the reasons for having a here doc is that you can set a different syntax highlighting. In Vim (or gvim) you can edit the perl.vim syntax file and impose a different set of colors for your SQL code. The only hairy thing is that you need to define a unique separator.
In my case, I have defined two areas where I want this particular double syntax, inside a qq{} string (without spaces before the brace. If I want normal perl syntax, I use qq {}) and inside here documents starting with <<SQL. This way I can decide which one to use, whether or not I am using hash variables inside my SQL string. I use bind vars inside my SQL, and they don't interfere with my double syntax highlighting.

The stylistic issue can be seen differently here, if we consider that we can have a separate syntax highlighting for embedded SQL (or HTML, XML, or whatever thing we are building from our Perl script).
More than style, I would say it is convenience, since syntax highlighting will catch typing mistakes before I close my editor. Since I produce and maintain several Perl/DBI scripts, I found a balance between how much to write and how much help I want to get from my editor. Besides, if I catch the error earlier, it's one time less that I have to fire the editor and modify the code.
OTOH, this benefit is lost when I send my code to somebody who doesn't benefit from this feature.
I just wanted to share my experience. A mix of personal taste and style.
_ _ _ _ (_|| | |(_|>< _|

In reply to Re: (jeffa) 5Re: SQL Query by gmax
in thread SQL Query by Anonymous Monk

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.