In perl.git, the branch smoke-me/alh/indented-heredocs has been created <http://perl5.git.perl.org/perl.git/commitdiff/a970a142ce686d6e2828d39a04d9c12ac089b09e?hp=0000000000000000000000000000000000000000>
at a970a142ce686d6e2828d39a04d9c12ac089b09e (commit) - Log ----------------------------------------------------------------- commit a970a142ce686d6e2828d39a04d9c12ac089b09e Author: Matthew Horsfall <wolfs...@gmail.com> Date: Fri Nov 11 06:35:32 2016 -0500 Document Indented Here-docs M pod/perlop.pod commit 31fc7cc5aca8512d49515cb42aca921f601db277 Author: Matthew Horsfall <wolfs...@gmail.com> Date: Fri Nov 11 04:58:18 2016 -0500 Add indented here-docs. This adds a new modifier '~' to here-docs 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"; <<~`EOF`; <<~ 'EOF'; <<~ "EOF"; <<~ `EOF`; The '~' modifier will strip, from each line in the here-doc, 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 here-doc doesn't match delimiter at - line 2. M pod/perldiag.pod M t/lib/warnings/toke M t/op/exec.t M t/op/heredoc.t M toke.c ----------------------------------------------------------------------- -- Perl5 Master Repository