"Relm" <relm / 3tlk.net> schrieb im Newsbeitrag
news:Pine.LNX.4.21.0503170235060.3371-100000 / frieza...
> On Thu, 17 Mar 2005, David Tran wrote:
>
> > It seems stupid to put ',' on next line but I have no choice,
> > here is my use case with heredoc example:
> > a = [
> > <<EOD1
> > abc
> > very very long string and many many lines ...
> > EOD1
> > ,
> > <<EOD2
> > 123
> > very very long string and many many lines ...
> > EOD2
> > ]
> >
> > I cannot put the ',' just after EOD1, it must to the next line,
> > if not, the "EOD1," is not consider termination of heredoc.
> > but put the ',' on next line then I got syntax error ...
>
> It may be more readable to put the expression on one line with all the
> heredocs stacked beneath:
>
> a = [<<EOD1, <<EOD2]
> abc
> very very long string and many many lines ...
> EOD1
> 123
> very very long string and many many lines ...
> EOD2

This works also:

a = [
<<EOD1,
abc
very very long string and many many lines ...
EOD1
<<EOD2,
123
very very long string and many many lines ...
EOD2
]

Note: "<<EOD1" is the expression that is replaced by the string, hence the
"," directly after it.

Kind regards

    robert