home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!usc!news.service.uci.edu!ucivax!ucla-cs!ucla-ma!julia!jbence
- From: jbence@julia.math.ucla.edu (James K. Bence)
- Subject: Re: bug with "last"
- Message-ID: <1993Jan11.161034.9577@math.ucla.edu>
- Summary: I don't think so
- Sender: news@math.ucla.edu
- Organization: UCLA Mathematics Department
- References: <cameron-930111155241-1-06364@fuligin>
- Date: Mon, 11 Jan 93 16:10:34 GMT
- Lines: 25
-
- In article <cameron-930111155241-1-06364@fuligin> cameron@cs.unsw.oz.au writes:
- >This loop runs three times.
- >
- > for (('a','b','c'))
- > { print "\$_ is '$_'\n";
- > { last; }
- > }
- >
- >Surely it shouldn't? This is perl 4.035.
- > - Cameron Simpson
- > cameron@cse.unsw.edu.au, DoD 0743
- >--
-
- I think it should. The 'last' terminates the block within which it is
- enclosed, which happens to be very short. I point to the Camel, pg. 97:
-
- "A BLOCK by itself (labeled or not) is equivalent to a loop that executes
- once. Thus you can use 'last' to leave the block or redo to restart
- the block." (An example follows in the text)
-
- James Bence
- Programmer/Analyst/Grad Student
- Univ. of Calif, Los Angeles
- Dept. of Mathematics
- jbence@math.ucla.edu
-