diff options
author | Matthew Horsfall <wolfsage@gmail.com> | 2016-11-14 08:03:33 -0500 |
---|---|---|
committer | Matthew Horsfall <wolfsage@gmail.com> | 2016-11-14 08:03:33 -0500 |
commit | 894226fa42af3bb6f50857abf7febd95b6fcd2bc (patch) | |
tree | 4c08d03daddec9e9c3e473a40e04ea68bb26a35d /pod | |
parent | 47eb44116b9aa0f7f4c7c732af48fc3dad2a7aa2 (diff) | |
download | perl-894226fa42af3bb6f50857abf7febd95b6fcd2bc.tar.gz |
Add perldelta for Indented Here-docs
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perldelta.pod | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod index d686561bde..4c15c0ae2a 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -27,6 +27,38 @@ here, but most should go in the L</Performance Enhancements> section. [ List each enhancement as a =head2 entry ] +=head2 Indented Here-documents + +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. + +For example: + + if (1) { + print <<~EOF; + Hello there + EOF + } + +prints "Hello there\n" with no leading whitespace. + =head1 Security XXX Any security-related notices go here. In particular, any security |