summaryrefslogtreecommitdiff
path: root/pod/perlsyn.pod
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2017-12-05 20:51:19 +0000
committerZefram <zefram@fysh.org>2017-12-05 20:54:02 +0000
commit557714184de18964b954b2c00fa13127fd3f216a (patch)
tree2e535e39b6836566618b19d7ca234c26771954b5 /pod/perlsyn.pod
parent3c0dbbbaeb55e36a6beabd1cfc9f0432053bcaf0 (diff)
downloadperl-557714184de18964b954b2c00fa13127fd3f216a.tar.gz
document hash/block disambig in perlsyn
Fixes [perl #130958].
Diffstat (limited to 'pod/perlsyn.pod')
-rw-r--r--pod/perlsyn.pod12
1 files changed, 10 insertions, 2 deletions
diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod
index efe4a26fc3..f5a2f2a92a 100644
--- a/pod/perlsyn.pod
+++ b/pod/perlsyn.pod
@@ -233,8 +233,16 @@ Sometimes a block is delimited by the file containing it (in the case
of a required file, or the program as a whole), and sometimes a block
is delimited by the extent of a string (in the case of an eval).
-But generally, a block is delimited by curly brackets, also known as braces.
-We will call this syntactic construct a BLOCK.
+But generally, a block is delimited by curly brackets, also known as
+braces. We will call this syntactic construct a BLOCK. Because enclosing
+braces are also the syntax for hash reference constructor expressions
+(see L<perlref>), you may occasionally need to disambiguate by placing a
+C<;> immediately after an opening brace so that Perl realises the brace
+is the start of a block. You will more frequently need to disambiguate
+the other way, by placing a C<+> immediately before an opening brace to
+force it to be interpreted as a hash reference constructor expression.
+It is considered good style to use these disambiguating mechanisms
+liberally, not only when Perl would otherwise guess incorrectly.
The following compound statements may be used to control flow: