Peter Scott writes:
> I dunno, maybe a last in a do block whose value is used by
> something should be a syntax error. We're talking about code like
>
> $x += do { $y = get_num; last if $y == 99; $y } while defined $y;
>
> right? *Shudder*
Yes, but we're also talking about code like
sub foo {
do {
...
last unless $x;
...
} while ($x < 20);
}
Here, the return value of do is used as the return value of foo, but
we may not actually care what foo returns. Do you want to make that a
syntax error? (Of course, you could use 'return' instead of 'last' in
this example, but that gets you some weird special cases. "You mean I
can use 'last' in a do loop, unless the do loop happens to be the last
statement in a subroutine?" And you can't use 'return' to substitute
for 'next'.)
--
Chris Madsen http://www.trx.com [EMAIL PROTECTED]
TRX Technology Services (214) 346-4611
- Re: The distinction between "do BLOCK ... Christopher J. Madsen
- Re: The distinction between "do BL... Jonathan Scott Duff
- Re: The distinction between "do BL... Christopher J. Madsen
- Re: The distinction between "do BL... Jonathan Scott Duff
- Re: The distinction between "do BL... Tom Christiansen
- Re: The distinction between "do BL... Christopher J. Madsen
- Re: The distinction between "do BL... Tom Christiansen
- Re: The distinction between "do BL... Christopher J. Madsen
- do BLOCK as inline sub? (was Re: "... Uri Guttman
- Re: The distinction between "do BLOCK while CON... Peter Scott
- Re: The distinction between "do BLOCK whil... Christopher J. Madsen
- Re: The distinction between "do BLOCK ... Peter Scott
- Re: The distinction between "do BL... Tom Christiansen
- Re: The distinction between "do BL... Chaim Frenkel
- Re: The distinction between "do BL... Tom Christiansen
- Re: The distinction between "do BL... Chaim Frenkel
- Re: The distinction between "do BL... Tom Christiansen
- Re: The distinction between "do BL... Chaim Frenkel
- Re: The distinction between "do BL... Tom Christiansen
- Re: The distinction between "do BL... Chaim Frenkel
- Re: The distinction between "do BL... Tom Christiansen
