Bart Lateur <[EMAIL PROTECTED]> writes:

> On 27 Aug 2000 19:23:51 -0000, Perl6 RFC Librarian wrote:
> 
> >Further it should ignore any whitespace (and comments) that follow the
> >terminator.
> 
> >      All of these should work:
> 
> >      print <<EOL ;
> >EOL     # this is the end of the here doc
> 
> But currently, I like using:
> 
>       print <<"#EOT#2";
> blah blah blah
> #EOT#2
> 

Well, this would still be well-defined according to my reading of the
RFC.  To parse <<"#EOT#2", the lexer (or whatever part of Perl it is)
has to scan the input stream until it encounters the stream "#EOT#2";
whitespace may appear before it on the line, and it may be followed by 
more whitespace and comments.  So even this should work:

    print <<"#EOT#2";
    This is a line of text.
    # This isn't a comment; it's part of the here-document!
    #EOT#2#This is a comment

I'm not sure if this is a good idea.  However, bear in mind that if
you want a comment on the end-of-here-document line, you probably
aren't going to add more `#' characters to it.

[...]

-- 
Ariel Scolnicov        |"GCAAGAATTGAACTGTAG"            | [EMAIL PROTECTED]
Compugen Ltd.          |Tel: +972-2-6795059 (Jerusalem) \ We recycle all our Hz
72 Pinhas Rosen St.    |Tel: +972-3-7658514 (Main office)`---------------------
Tel-Aviv 69512, ISRAEL |Fax: +972-3-7658555    http://3w.compugen.co.il/~ariels

Reply via email to