On Tue, Aug 22, 2006 at 08:12:09PM +0100, Daniel Hulme wrote: : > : my $a = q:t /END/ : > : test : > : END; : : > : print qq:to/END/; : > : Give $amount to the man behind curtain number $curtain. : > : END : : > : Which is correct? : : > Both of them are. See the table further down that says: : : What about the semicolon? After the terminator, or after the opening : line?
Ah, missed that, thanks. On the opening line is correct, just as in Perl 5. The heredoc is just a term with some indirection, and the indirection is completely line oriented. The terminator must still be on a line by itself, with nothing but whitespace. We could just as easily have a POD indirection that said print qq:from/FOO/; and it would go looking for the nearest =begin FOO block to insert. So syntactically, it's only sort of happenstance that with heredocs the document happens to be "here". The inline-ness of it is secondary to the line-orientedness of it, in my mind. And it is often not, in fact, truly inline, as demonstrated by print qq:to/FOO/, qq:to/BAR/; ... FOO ... BAR It's really just a way to abstract a large string containing newlines into a single token that doesn't. Larry