document non-loopish blocks better
authorM. J. T. Guy <mjtg@cus.cam.ac.uk>
Tue, 18 Aug 1998 12:28:36 +0000 (13:28 +0100)
committerGurusamy Sarathy <gsar@cpan.org>
Wed, 23 Sep 1998 04:35:46 +0000 (04:35 +0000)
Message-Id: <E0z8jwK-00057Z-00@ursa.cus.cam.ac.uk>
Subject: Re: next in do {} while block gives error message

p4raw-id: //depot/perl@1811

pod/perlfunc.pod

index 9cab569..2d7b251 100644 (file)
@@ -894,6 +894,9 @@ sequence of commands indicated by BLOCK.  When modified by a loop
 modifier, executes the BLOCK once before testing the loop condition.
 (On other statements the loop modifiers test the conditional first.)
 
+C<do BLOCK> does I<not> count as a loop, so the loop control statements
+C<next>, C<last> or C<redo> cannot be used to leave or restart the block.
+
 =item do SUBROUTINE(LIST)
 
 A deprecated form of subroutine call.  See L<perlsub>.
@@ -1152,6 +1155,10 @@ normally you I<WOULD> like to use double quotes, except that in this
 particular situation, you can just use symbolic references instead, as
 in case 6.
 
+C<eval BLOCK> does I<not> count as a loop, so the loop control statements
+C<next>, C<last> or C<redo> cannot be used to leave or restart the block.
+
+
 =item exec LIST
 
 =item exec PROGRAM LIST
@@ -1938,6 +1945,9 @@ C<continue> block, if any, is not executed:
        #...
     }
 
+C<last> cannot be used to exit a block which returns a value such as
+C<eval {}>, C<sub {}> or C<do {}>.
+
 See also L</continue> for an illustration of how C<last>, C<next>, and
 C<redo> work.
 
@@ -2139,6 +2149,9 @@ Note that if there were a C<continue> block on the above, it would get
 executed even on discarded lines.  If the LABEL is omitted, the command
 refers to the innermost enclosing loop.
 
+C<next> cannot be used to exit a block which returns a value such as
+C<eval {}>, C<sub {}> or C<do {}>.
+
 See also L</continue> for an illustration of how C<last>, C<next>, and
 C<redo> work.
 
@@ -2769,6 +2782,9 @@ themselves about what was just input:
        print;
     }
 
+C<redo> cannot be used to retry a block which returns a value such as
+C<eval {}>, C<sub {}> or C<do {}>.
+
 See also L</continue> for an illustration of how C<last>, C<next>, and
 C<redo> work.