In perl.git, the branch alh/indented-here-docs has been created <http://perl5.git.perl.org/perl.git/commitdiff/46718bc3474e1d0936c8d149db4c2abbcc7cccc9?hp=0000000000000000000000000000000000000000>
at 46718bc3474e1d0936c8d149db4c2abbcc7cccc9 (commit) - Log ----------------------------------------------------------------- commit 46718bc3474e1d0936c8d149db4c2abbcc7cccc9 Author: Matthew Horsfall <wolfs...@gmail.com> Date: Fri Nov 11 06:35:32 2016 -0500 Document Indented Heredocs M pod/perlop.pod commit ec684f594abacad62c8902a425a14d9052c4ada1 Author: Matthew Horsfall <wolfs...@gmail.com> Date: Fri Nov 11 04:58:18 2016 -0500 Add indented heredocs. This adds a new modifier '~' to heredocs that tells the parser that it should look for /^\s*$DELIM\n/ as the closing delimiter. These syntaxes are all supported: <<~EOF; <<~'EOF'; <<~"EOF"; <<~\EOF; The '~' modifier will strip, from each line in the heredoc, the same whitespace that appears before the delimiter. Newlines will be copied as is, and lines that don't include the proper beginning whitespace will cause perl to croak. Some examples: if (1) { print <<~EOF; Hello there EOF } prints "Hello there\n"; The following: if (1) { print <<~EOF; Hello There EOF } croaks with: Indentation on line 1 of heredoc doesn't match delimiter at - line 2. M pod/perldiag.pod M t/op/exec.t M t/op/heredoc.t M toke.c ----------------------------------------------------------------------- -- Perl5 Master Repository