in reply to here documents formatting

You probably have it like:
while () { print <<END; my text END }
when, as you are recognizing, needs to be
while () { print <<END; my text END }
While you can modify the here document starting point, such as
print << END;
where that space is a tab character, this would look worse.

I've run into the same problem, and for things like sql statements, I find it better to use q() and friends, such as:

$sth=$dbi->prepare( q/ SELECT * FROM my_table WHERE AVERAGE( cost ) < ? /) or die DBI->errstr;
The indents in this code will rarely affect SQL, and probably only a few select other cases will it be a problem.


Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain

Replies are listed 'Best First'.
Re: Re: here documents formatting
by the_0ne (Pilgrim) on Apr 07, 2001 at 04:46 UTC
    Ok, that's fine with me. Using the q\\ is still much better than...

    $strSQL = "SELECT * " .
    "FROM TABLE";

    So, I changed it to this...
    $strSQL = q|
    SELECT *
    FROM TABLE|;

    ...and that worked fine. Now at least I know that the other method isn't viable other than up against the left margin of the perl file.

    Thanks for the replies monks.