summaryrefslogtreecommitdiff
path: root/pod/perlref.pod
diff options
context:
space:
mode:
authorPhil Monsen <philip.monsen@pobox.com>2011-07-09 21:15:40 -0500
committerFather Chrysostomos <sprout@cpan.org>2011-07-10 06:08:57 -0700
commit903c0e71ef4db59d59dc1e818fd65b4096c422a1 (patch)
tree32e0dab6a12caa7665d868abbd45f2eb7e5a9461 /pod/perlref.pod
parent5aeca1f7a73a0abecd5e1b5cb8b7462cf3369f85 (diff)
downloadperl-903c0e71ef4db59d59dc1e818fd65b4096c422a1.tar.gz
perlref: update bareword bracketing discussion, mention new auto-dereferencing
Diffstat (limited to 'pod/perlref.pod')
-rw-r--r--pod/perlref.pod29
1 files changed, 21 insertions, 8 deletions
diff --git a/pod/perlref.pod b/pod/perlref.pod
index f45a3836e2..f1dffceeff 100644
--- a/pod/perlref.pod
+++ b/pod/perlref.pod
@@ -51,6 +51,19 @@ scalar is holding a reference, it always behaves as a simple scalar. It
doesn't magically start being an array or hash or subroutine; you have to
tell it explicitly to do so, by dereferencing it.
+References are easy to use in Perl. There is just one overriding
+principle: in general, Perl does no implicit referencing or dereferencing.
+When a scalar is holding a reference, it always behaves as a simple scalar.
+It doesn't magically start being an array or hash or subroutine; you have to
+tell it explicitly to do so, by dereferencing it.
+
+That said, be aware that Perl version 5.14 introduces an exception
+to the rule, for syntactic convenience. Experimental array and hash container
+function behavior allows array and hash references to be handled by Perl as
+if they had been explicitly syntactically dereferenced. See
+L<perl5140delta/"Syntactical Enhancements">
+and L<perlfunc> for details.
+
=head2 Making References
X<reference, creation> X<referencing>
@@ -562,16 +575,16 @@ variables, which are all "global" to the package.
=head2 Not-so-symbolic references
-A new feature contributing to readability in perl version 5.001 is that the
-brackets around a symbolic reference behave more like quotes, just as they
-always have within a string. That is,
+Since Perl verion 5.001, brackets around a symbolic reference can simply
+serve to isolate an identifier or variable name from the rest of an
+expression, just as they always have within a string. For example,
$push = "pop on ";
print "${push}over";
has always meant to print "pop on over", even though push is
-a reserved word. This has been generalized to work the same outside
-of quotes, so that
+a reserved word. In 5.001, this was generalized to work the same
+without the enclosing double quotes, so that
print ${push} . "over";
@@ -588,9 +601,9 @@ using strict refs:
${ bareword }; # Okay, means $bareword.
${ "bareword" }; # Error, symbolic reference.
-Similarly, because of all the subscripting that is done using single
-words, we've applied the same rule to any bareword that is used for
-subscripting a hash. So now, instead of writing
+Similarly, because of all the subscripting that is done using single words,
+the same rule applies to any bareword that is used for subscripting a hash.
+So now, instead of writing
$array{ "aaa" }{ "bbb" }{ "ccc" }