[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] '' vs q()



At 13:43 -0700 18.05.98, Peter Prymmer wrote:

>$ perl
>print << q(EOT):
>I don\'t know about that.  Sometimes I want a single \\ in my strings.
>EOT
>^D
>Can't find string terminator "" anywhere before EOF at - line 1.

>From the Camel book, p. 43:

"There must be no space between the << and the identifier. (If you insert a
space, it will be treated as a null identifier, which is valid but
deprecated, and matches the first blank line [...]"

So what can we learn from that? First of all, your example doesn't have a
blank line to end the here document, so perl gives a valid error message.

Second, while the Camel book starts the description of here documents with
"Following a << you specify a string to terminate the quoted material
[...]" it continues to talk about "identifiers" later on. The Camel book
seems to be somewhat sloppy here ;-) using "quoted string" in the
traditional meaning of a sequence of characters enclosed in either single
or double quotes.

Finally, it is my opinion that here documents should be deprecated in the
next version, because one can easily accomplish the same with generalized
quoting which is less troublesome syntactically.

	--jc

--
JŸrgen Christoffel, GMD - Forschungszentrum Informationstechnik GmbH
E-Mail: christoffel@gmd.de or one of {ftp,news,web}master@gmd.de



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch