@@ -2842,16 +2842,13 @@ must use an C<eval()>:
28422842 eval "tr/$oldlist/$newlist/, 1" or die $@;
28432843
28442844=item C<< <<I<EOF> >>
2845- X<here-doc> X<heredoc> X<here-document> X<<< << >>>
2845+ X<here-doc> X<here-docs> X< heredoc> X<here-document> X<<< << >>>
28462846
28472847A line-oriented form of quoting is based on the shell "here-document"
28482848syntax. Following a C<< << >> you specify a string to terminate
28492849the quoted material, and all lines following the current line down to
28502850the terminating string are the value of the item.
28512851
2852- Prefixing the terminating string with a C<~> specifies that you
2853- want to use L</Indented Here-docs> (see below).
2854-
28552852The terminating string may be either an identifier (a word), or some
28562853quoted text. An unquoted identifier works like double quotes.
28572854There may not be a space between the C<< << >> and the identifier,
@@ -2862,6 +2859,52 @@ on the terminating line.
28622859If the terminating string is quoted, the type of quotes used determine
28632860the treatment of the text.
28642861
2862+ my $person = 'John';
2863+
2864+ print uc << "EOT";
2865+ Hello, $person!
2866+ And the text goes on.
2867+ EOT
2868+
2869+ This yields
2870+
2871+ HELLO, JOHN!
2872+ AND THE TEXT GOES ON.
2873+
2874+ The same result happens if the double quotes are omitted
2875+
2876+ my $person = 'John';
2877+ print uc <<EOT;
2878+ Hello, $person!
2879+ And the text goes on.
2880+ EOT
2881+
2882+ HELLO, JOHN!
2883+ AND THE TEXT GOES ON.
2884+
2885+ If instead, single quotes are used, we get
2886+
2887+ print uc <<'EOT';
2888+ Hello, $person!
2889+ And the text goes on.
2890+ EOT
2891+
2892+ my $person = 'John';
2893+ HELLO, $PERSON!
2894+ AND THE TEXT GOES ON.
2895+
2896+ You can do fancy things like call a function with the here-document
2897+
2898+ print uc(<<EOF);
2899+ abc
2900+ EOF
2901+
2902+ ABC
2903+
2904+ It is usually easier to read the code if the here-document is indented.
2905+ Prefixing the terminating string with a C<~> specifies that you
2906+ want to use L</Indented Here-docs> (see below).
2907+
28652908=over 4
28662909
28672910=item Double Quotes
0 commit comments