Newsgroups: comp.lang.perl
From: lw...@netlabs.com (Larry Wall)
Date: 17 Jan 92 00:54:05 GMT
Local: Thurs, Jan 16 1992 7:54 pm
Subject: Re: Double feature: the next statement
:
: This "double feature" is present in Perl 4.019 on a Sun4 running : sunos 4.1.1. : When doing a next within a subroutine which is : called within a loop and the next itself is NOT within a loop, the next : is NOT flagged as an error but gives back the control outside the : subroutine. This first feature is NOT documented in the perl book and : I feel that it is a bug since the fact whether the statement is : syntacticaly valid depends on the USAGE of the subroutine rather than : its definition! Without the outside loop, I get an error message: : Bad label: <null> at - line 4. : : The double part of this feature is that the subroutine can AFFECT : where the next statement returns OUTSIDE of it!! In the example below, : the PRESENCE of the NEVER executed return statement, affects whether : the statement "next" will give back control just after the call of : the subroutine or outside the loop which called the subroutine! Okay, I'll give you a third feature that goes with the other two. In a Here's a fourth. You can exit an eval by saying "last _EVAL_". How 'bout this: FOO: { These are all accidents of an implementation using longjmp() and a If I don't document something, it's usually either for a good reason, Larry You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||