summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDagfinn Ilmari Mannsåker <ilmari@ilmari.org>2020-08-17 23:55:44 +0100
committerDagfinn Ilmari Mannsåker <ilmari@ilmari.org>2020-08-17 23:55:44 +0100
commit415e46676dcfccc6f5a90eabdf68f09493dde977 (patch)
treea211f84cf2dc336c9404e3382317dfa147cf8462
parentaf4e95752ae04f8f6f824b9da507287a3006618f (diff)
downloadperl-415e46676dcfccc6f5a90eabdf68f09493dde977.tar.gz
perlref.pod: Fix heading levels and ordering
Commit cb1a09d0194fed9b905df7b04a4bc031d354609d (perl 5.002) promoted the WARNING and SEE ALSO headings in perlref from `=head2` to `=head1`, but subsequent changes added things that should have been `=head2` before the WARNING as `=head1` between the two. Commit f0d9913136619e8b6716f2dfa6d8524a6df9e2c0 fixed some of those heading levels, but left "Declaring a Reference to a Variable" as `=head1`.
-rw-r--r--pod/perlref.pod42
1 files changed, 21 insertions, 21 deletions
diff --git a/pod/perlref.pod b/pod/perlref.pod
index 2c4cedfe64..5cd9ee21f8 100644
--- a/pod/perlref.pod
+++ b/pod/perlref.pod
@@ -712,26 +712,6 @@ 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: 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
-converted into a string:
-
- $x{ \$a } = $a;
-
-If you try to dereference the key, it won't do a hard dereference, and
-you won't accomplish what you're attempting. You might want to do something
-more like
-
- $r = \@a;
- $x{ $r } = $r;
-
-And then at least you can use the values(), which will be
-real refs, instead of the keys(), which won't.
-
-The standard Tie::RefHash module provides a convenient workaround to this.
-
=head2 Postfix Dereference Syntax
Beginning in v5.20.0, a postfix syntax for using references is
@@ -903,7 +883,7 @@ will only be visible within that inner sub, and will not affect the outer
subroutine where the variables are declared. This bizarre behavior is
subject to change.
-=head1 Declaring a Reference to a Variable
+=head2 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
@@ -926,6 +906,26 @@ used on just some items in a list of declared variables:
my ($foo, \@bar, \%baz); # equivalent to: my $foo, \my(@bar, %baz);
+=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
+converted into a string:
+
+ $x{ \$a } = $a;
+
+If you try to dereference the key, it won't do a hard dereference, and
+you won't accomplish what you're attempting. You might want to do something
+more like
+
+ $r = \@a;
+ $x{ $r } = $r;
+
+And then at least you can use the values(), which will be
+real refs, instead of the keys(), which won't.
+
+The standard Tie::RefHash module provides a convenient workaround to this.
+
=head1 SEE ALSO
Besides the obvious documents, source code can be instructive.