Re: The distinction between "do BLOCK while COND" and "EXPR while COND" should go
[email protected] (Peter Scott) Thu, 31 Aug 2000 12:09:57 -0700
| Newsgroups | perl.perl6.language.flow |
|---|---|
| Message-ID | <[email protected]> |
At 11:21 AM 8/31/00 -0600, Tom Christiansen wrote:
> >I want last, next, etc. to magically work where I want them to:
I too want last to work in do loops.
> > do {
> > last if /booger/;
> > ...
> > } while ( ... );
>
>Special cased for postfix modifiers, or generalized? If so,
>what's the return value?
If anyone cared about the return value from a broken do loop, we could
always say it was undef. Or cook up some scheme where you could say
last [LABEL] [retval]
where retval could be recognized by being a reference or something
obviously not a label.
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*
--
Peter Scott
Pacific Systems Design Technologies