now it is over! END # this is equivalent to: say("This is the beginning:\nthis is the middle\nAnd now it is over!\n"); The tag itself may contain whitespace, which may allow heredocs to be used without breaking indentation. say <<' END'; Hello World END Although since Perl version 5.26, heredocs can include indention: #prints "Hello there\n" with no leading whitespace. if (1) { print <<~EOF; Hello there EOF } In addition to these strings, Perl also features file literals, namely the contents of the file following (formerly ) on a line by itself. This is accessible as the file object PACKAGE::DATA such as main::DATA, and can be viewed as a form of data segment. PHP In PHP, here documents are referred to as heredocs. In PHP heredocs are not string literals. Heredoc text behaves just like a double-quoted string, but without the double quotes. For example, meaning `$` will be parsed as a variable start, and `${` or `{$` as a complex variable start. <?php $name = "Joe Smith"; $occupation = "Programmer"; echo <<<EOF This is a heredoc section. For more information talk to $name, your local $occupation. Thanks! EOF; $toprint = <<<EOF Hey $name! You can actually assign the heredoc section to a variable! EOF; echo $toprint; ?> Outputs This is a heredoc section. For more information talk to Joe Smith, your local Programmer. Thanks! Hey Joe Smith! You can actually assign the heredoc section to a variable! In PHP versions prior to 7.3, the line containing the closing identifier must not contain any other characters, except an optional ending semicolon. Otherwise, it will not be considered to be a closing identifier, and PHP will continue looking for one. If a proper closing identifier is not found, a parse error will result at the last line of the script. However, from version 7.3, it is no longer required that the closing identifier be followed by a semicolon or newline. Additionally the closing identifier may be indented, in which case the indentation will be stripped from all lines in the doc string. In PHP 5.3 and later, like Perl, it is possible to not interpolate variables by surrounding the tag with single quotes; this is called a nowdoc: $x = <<<'END' Dear $recipient, I wish you to leave Sunnydale and never return. Not Quite Love, $sender END; In PHP 5.3+ it is also possible to surround the tag with double quotes,