summaryrefslogtreecommitdiff
path: root/pod/perlfunc.pod
diff options
context:
space:
mode:
authorRicardo Signes <rjbs@cpan.org>2013-06-17 18:21:51 -0400
committerRicardo Signes <rjbs@cpan.org>2013-06-18 19:01:53 -0400
commit3e8a637058231ac4d3a9cedc549bfb1b8ee36c68 (patch)
treeddcab8c7979f58457c6b6ce87a6121cd14deb74b /pod/perlfunc.pod
parentb79536ea166b1ad79b3c02ab33e1d9f71044b45c (diff)
downloadperl-3e8a637058231ac4d3a9cedc549bfb1b8ee36c68.tar.gz
document that goto-EXPR will treat a subref differently
This has been the case since Perl 5.8 at least, and possibly longer. This resolves [perl #118523].
Diffstat (limited to 'pod/perlfunc.pod')
-rw-r--r--pod/perlfunc.pod7
1 files changed, 6 insertions, 1 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 4562b2c905..9428a4d67a 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -2929,7 +2929,12 @@ The author of Perl has never felt the need to use this form of C<goto>
does not offer named loops combined with loop control. Perl does, and
this replaces most structured uses of C<goto> in other languages.)
-The C<goto-EXPR> form expects a label name, whose scope will be resolved
+The C<goto-EXPR> form expects to evaluate C<EXPR> to a code reference or
+a label name. If it evaluates to a code reference, it will be handled
+like C<goto-&NAME>, below. This is especially useful for implementing
+tail recursion via C<goto __SUB__>.
+
+If the expression evaluates to a label name, its scope will be resolved
dynamically. This allows for computed C<goto>s per FORTRAN, but isn't
necessarily recommended if you're optimizing for maintainability: