home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!reed!romulus!merlyn
- From: merlyn@ora.com (Randal L. Schwartz)
- Newsgroups: comp.lang.perl
- Subject: Re: bug with "last"
- Message-ID: <MERLYN.93Jan11120951@romulus.reed.edu>
- Date: 11 Jan 93 20:09:56 GMT
- Article-I.D.: romulus.MERLYN.93Jan11120951
- References: <cameron-930111155241-1-06364@fuligin> <1993Jan11.175416.3503@netcom.com>
- Sender: news@reed.edu (USENET News System)
- Organization: Stonehenge Consulting Services; Portland, Oregon, USA
- Lines: 29
- In-Reply-To: lgolding@netcom.com's message of Mon, 11 Jan 1993 17:54:16 GMT
-
- >>>>> In article <1993Jan11.175416.3503@netcom.com>, lgolding@netcom.com (Laurence J. Golding) writes:
- Laurence> Within the BLOCK of any compound loop statement, you may use ...
- Laurence> last
- Laurence> last LABEL
- Laurence> ... If the LABEL is omitted, the loop control statement refers to
- Laurence> the innermost enclosing loop.
-
- Laurence> Now, in your example, the "{last;}" certainly does not look like a loop,
- Laurence> and the "for" certainly does look like the innermost enclosing loop. So it
- Laurence> appears that the book should read:
-
- Laurence> ... If the LABEL is ommitted, the loop control statement refers to
- Laurence> the innermost enclosing _block_.
-
- Ahhh. But it's not just a block, or the branches of an "if" would count.
-
- So, we have three overloaded uses of curlies: an "if" branch, a naked
- block, and a traditional loop. "last" applies to the last two, so
- we've collectively called them (defined in folklore) as "loops". All
- three qualify as "blocks", using the C definition, so changing the
- Camel reference to "block" doesn't cut it.
-
- OK, so the folklore should have been described. Sorry. :-)
-
- { print "Just another Perl hacker,"; last; }
- --
- Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
- merlyn@ora.com (semi-permanent) merlyn@reed.edu (for newsreading only)
- factoid: "Portland, Oregon, home of the California Raisins and Lone-Star Beer!"
-