From: SADAHIRO Tomoyuki Date: Sun, 9 Jul 2006 11:57:42 +0000 (+0900) Subject: Re: Misunderstanding escapes in heredocs? X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=872d7e53b29f06ce069b05dc9063be581f956098;p=p5sagit%2Fp5-mst-13.2.git Re: Misunderstanding escapes in heredocs? Message-Id: <20060709115613.78FF.BQW10602@nifty.com> p4raw-id: //depot/perl@28547 --- diff --git a/pod/perlop.pod b/pod/perlop.pod index b1348fa..1144a49 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -1685,9 +1685,15 @@ try to do this: ABC + 20; -If you want your here-docs to be indented with the -rest of the code, you'll need to remove leading whitespace -from each line manually: +If you want to remove the line terminator from your here-docs, +use C. + + chomp($string = <<'END'); + This is a string. + END + +If you want your here-docs to be indented with the rest of the code, +you'll need to remove leading whitespace from each line manually: ($quote = <<'FINIS') =~ s/^\s+//gm; The Road goes ever on and on, @@ -1761,7 +1767,7 @@ one to five, but these passes are always performed in the same order. =item Finding the end The first pass is finding the end of the quoted construct, whether -it be a multicharacter delimiter C<"\nEOF\n"> in the C<< +it be a multicharacter delimiter C<"EOF\n"> in the C<< construct, a C that terminates a C construct, a C<]> which terminates C construct, or a C<< > >> which terminates a fileglob started with C<< < >>. @@ -1771,7 +1777,8 @@ as C, combinations of C<\\> and C<\/> are skipped. However, when searching for single-character pairing delimiter like C<[>, combinations of C<\\>, C<\]>, and C<\[> are all skipped, and nested C<[>, C<]> are skipped as well. When searching for multicharacter -delimiters, nothing is skipped. +delimiters like C<"EOF\n">, nothing is skipped, though the delimiter +must start from the first column of the terminating line. For constructs with three-part delimiters (C, C, and C), the search is repeated once more.