summaryrefslogtreecommitdiff
path: root/pod/perlref.pod
diff options
context:
space:
mode:
Diffstat (limited to 'pod/perlref.pod')
-rw-r--r--pod/perlref.pod13
1 files changed, 11 insertions, 2 deletions
diff --git a/pod/perlref.pod b/pod/perlref.pod
index 6aa086088d..34c071fcfe 100644
--- a/pod/perlref.pod
+++ b/pod/perlref.pod
@@ -15,9 +15,9 @@ hashes, hashes of arrays, arrays of hashes of functions, and so on.
Hard references are smart--they keep track of reference counts for you,
automatically freeing the thing referred to when its reference count goes
-to zero. (Note: The reference counts for values in self-referential or
+to zero. (Note: the reference counts for values in self-referential or
cyclic data structures may not go to zero without a little help; see
-L<perlobj/"Two-Phased Garbage Collection"> for a detailed explanation.
+L<perlobj/"Two-Phased Garbage Collection"> for a detailed explanation.)
If that thing happens to be an object, the object is destructed. See
L<perlobj> for more about objects. (In a sense, everything in Perl is an
object, but we usually reserve the word for references to objects that
@@ -120,6 +120,15 @@ reference to it, you have these options:
sub hashem { +{ @_ } } # ok
sub hashem { return { @_ } } # ok
+On the other hand, if you want the other meaning, you can do this:
+
+ sub showem { { @_ } } # ambiguous (currently ok, but may change)
+ sub showem { {; @_ } } # ok
+ sub showem { { return @_ } } # ok
+
+Note how the leading C<+{> and C<{;> always serve to disambiguate
+the expression to mean either the HASH reference, or the BLOCK.
+
=item 4.
A reference to an anonymous subroutine can be constructed by using