From: "Peter J. Holzer" <[EMAIL PROTECTED]>
> On 2008-01-14 13:07:17 +0100, Jenda Krynicky wrote:
> > From: "Peter J. Holzer" <[EMAIL PROTECTED]>
> > > As an aside, the SPL programming language[2] allows the terminator of a
> > > here document to be indented and to strip off everything up to and
> > > including some character from each line, so that could be written like
> > > this:
> > >
> > > function foo() {
> > > some;
> > > code;
> > > here;
> > > if (bla) {
> > > more;
> > > code;
> > > here;
> > > var sql = >>SQL|
> > > |SELECT
> > > | jo.departure_date AS departure
> > > |, eq.name AS equipment
> > > |, dp.full_city AS departure_city
> > > |, ap.full_city AS arrival_city
> > > |, ca.name AS carrier_name
> > > |, jo.number
> > > |[...]
> > > SQL;
> > > even;
> > > more;
> > > }
> > > code;
> > > here;
> > > }
> >
> > That kinda defeats the purpose of heredocs, namely allowing me to
> > copy&paste some data into/out of the script without having to escape
> > or modify anything.
>
> In most cases this works with q{} just the same (the only exception is
> the sequence \\, which unfortunately represents only a single backslash
> inside q{}.
And with the exception of an unballanced { or } which causes the
literal to end either too soon or too late.
Unlikely to occure in SQL I admit, not so in other things. Besides
the only difference as far as formatting goes is the end marker. With
heredoc it has to be at the beginning of a line, in case of q{} it
may be anywhere. If the leading whitespace is meaningfull in whatever
it is you are quoting, you have exactly the same problem with here-
docs and q{}.
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery