in reply to Re: Why does $sql = EOSQL; require EOSQL to be in column 0?
in thread Why does $sql = <<EOSQL; require EOSQL to be in column 0?

Whenever you have variables in your heredoc, you will want to use double quotes in the example dws suggests. Otherwise the here doc will be single-quotish and the variables will not interpolate:
$sql = <<" EOSQL"; ... EOSQL
This technique breaks of course if you change the indenting on the heredoc itself without changing the indent on the '<<' line. So you will need to decide if the readability is sufficient advantage to make up for the maintenance issue.

Replies are listed 'Best First'.
Re: Re: Re: Why does $sql = EOSQL; require EOSQL to be in column 0?
by chipmunk (Parson) on Feb 23, 2001 at 08:33 UTC
    FYI, if you leave off the quotes around your here-doc terminator, then you get the double-quotish, not single-quotish, behavior. To get a single-quotish here-doc, you have to explicitly use single quotes.
    $name = 'Bob'; my $text = <<EOT; Hello, $name! EOT print $text;