This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
5.31.3 today
[perl5.git] / pod / perlref.pod
index a071f1f..4982b65 100644 (file)
@@ -603,23 +603,23 @@ 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" }
+    $hash{ "aaa" }{ "bbb" }{ "ccc" }
 
 you can write just
 
-    $array{ aaa }{ bbb }{ ccc }
+    $hash{ aaa }{ bbb }{ ccc }
 
 and not worry about whether the subscripts are reserved words.  In the
 rare event that you do wish to do something like
 
-    $array{ shift }
+    $hash{ shift }
 
 you can force interpretation as a reserved word by adding anything that
 makes it more than a bareword:
 
-    $array{ shift() }
-    $array{ +shift }
-    $array{ shift @_ }
+    $hash{ shift() }
+    $hash{ +shift }
+    $hash{ shift @_ }
 
 The C<use warnings> pragma or the B<-w> switch will warn you if it
 interprets a reserved word as a string.
@@ -718,7 +718,7 @@ outer() at the time outer is invoked.
 This has the interesting effect of creating a function local to another
 function, something not normally supported in Perl.
 
-=head1 WARNING
+=head1 WARNING: Don't use references as hash keys
 X<reference, string context> X<reference, use as hash key>
 
 You may not (usefully) use a reference as the key to a hash.  It will be
@@ -738,7 +738,7 @@ real refs, instead of the keys(), which won't.
 
 The standard Tie::RefHash module provides a convenient workaround to this.
 
-=head1 Postfix Dereference Syntax
+=head2 Postfix Dereference Syntax
 
 Beginning in v5.20.0, a postfix syntax for using references is
 available.  It behaves as described in L</Using References>, but instead
@@ -798,7 +798,7 @@ As with postfix array, postfix value slice dereferencing I<can> be used
 in interpolating strings (double quotes or the C<qq> operator), but only
 if the C<postderef_qq> L<feature> is enabled.
 
-=head1 Assigning to References
+=head2 Assigning to References
 
 Beginning in v5.22.0, the referencing operator can be assigned to.  It
 performs an aliasing operation, so that the variable name referenced on the
@@ -868,7 +868,7 @@ Combining that form with C<local> and putting parentheses immediately
 around a hash are forbidden (because it is not clear what they should do):
 
     \local(@array) = foo(); # WRONG
-    \(%hash)       = bar(); # wRONG
+    \(%hash)       = bar(); # WRONG
 
 Assignment to references and non-references may be combined in lists and
 conditional ternary expressions, as long as the values on the right-hand
@@ -911,7 +911,10 @@ subject to change.
 
 =head1 Declaring a Reference to a Variable
 
-Beginning in v5.26.0, the referencing operator can come after C<my>, C<state>, C<our>, or C<local>.  This syntax must be enabled with C<use feature 'declared_refs'>.  It is experimental, and will warn by default unless C<no warnings 'experimental::refaliasing'> is in effect.
+Beginning in v5.26.0, the referencing operator can come after C<my>,
+C<state>, C<our>, or C<local>.  This syntax must be enabled with C<use
+feature 'declared_refs'>.  It is experimental, and will warn by default
+unless C<no warnings 'experimental::refaliasing'> is in effect.
 
 This feature makes these: