On Sat, 02 Oct 1999 20:56:32 BST, Ian Phillipps wrote:
>Hmm.. the documentation of 'last' and its friends has confused two of
>us so far. Maybe perlfunc should simply refer us to perlsyn, rather than
>trying to define all the cases itself.
FWIW, I added what's attached. If you had something else in mind,
consider sending a patch.
Sarathy
gsar@activestate.com
-----------------------------------8<-----------------------------------
Change 4277 by gsar@auger on 1999/10/02 01:43:25
add notes about effect of loop control statements inside
LABEL BLOCK continue BLOCK
Affected files ...
... //depot/perl/pod/perlfunc.pod#105 edit
Differences ...
==== //depot/perl/pod/perlfunc.pod#105 (text) ====
Index: perl/pod/perlfunc.pod
--- perl/pod/perlfunc.pod.~1~ Fri Oct 1 18:43:28 1999
+++ perl/pod/perlfunc.pod Fri Oct 1 18:43:28 1999
@@ -2149,6 +2149,10 @@
C<eval {}>, C<sub {}> or C<do {}>, and should not be used to exit
a grep() or map() operation.
+Note that a block by itself is semantically identical to a loop
+that executes once. Thus C<last> can be used to effect an early
+exit out of such a block.
+
See also L</continue> for an illustration of how C<last>, C<next>, and
C<redo> work.
@@ -2394,6 +2398,9 @@
C<eval {}>, C<sub {}> or C<do {}>, and should not be used to exit
a grep() or map() operation.
+Note that a block by itself is semantically identical to a loop
+that executes once. Thus C<next> will exit such a block early.
+
See also L</continue> for an illustration of how C<last>, C<next>, and
C<redo> work.
@@ -3284,6 +3291,10 @@
C<redo> cannot be used to retry a block which returns a value such as
C<eval {}>, C<sub {}> or C<do {}>, and should not be used to exit
a grep() or map() operation.
+
+Note that a block by itself is semantically identical to a loop
+that executes once. Thus C<redo> inside such a block will effectively
+turn it into a looping construct.
See also L</continue> for an illustration of how C<last>, C<next>, and
C<redo> work.
End of Patch.
Thread Previous
|
Thread Next