home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / perl / 7759 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  1.3 KB

  1. Path: sparky!uunet!olivea!sgigate!sgi!wdl1!wdl39!mab
  2. From: mab@wdl39.wdl.loral.com (Mark A Biggar)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: bug with "last"
  5. Message-ID: <1993Jan11.223151.4786@wdl.loral.com>
  6. Date: 11 Jan 93 22:31:51 GMT
  7. References: <cameron-930111155241-1-06364@fuligin> <1993Jan11.175416.3503@netcom.com>
  8. Sender: news@wdl.loral.com
  9. Organization: Loral Western Development Labs
  10. Lines: 20
  11.  
  12. In article <1993Jan11.175416.3503@netcom.com> lgolding@netcom.com (Laurence J. Golding) writes:
  13. >    ... If the LABEL is omitted, the loop control statement refers to
  14. >    the innermost enclosing loop.
  15. >Now, in your example, the "{last;}" certainly does not look like a loop,
  16. >and the "for" certainly does look like the innermost enclosing loop.  So it
  17. >appears that the book should read:
  18. >    ... If the LABEL is ommitted, the loop control statement refers to
  19. >    the innermost enclosing _block_.
  20.  
  21. This rule doesn't work because last ignores BLOCKS that are branches of
  22. if statements and the BLOCK in a do {...} expression.  As the book and man 
  23. page say a unadorned BLOCK is equivalent to a do-it-once loop.  Now you
  24. might get away with saying "the innermost BLOCK that is the body of a loop"
  25. but that would get confused with my last does not work with do {...} while();
  26. So, I guess the best thing is to just leave it alone.
  27.  
  28. --
  29. Perl's Maternal Uncle
  30. Mark Biggar
  31. mab@wdl1.wdl.loral.com
  32.