At 02:30 PM 8/31/00 -0500, Christopher J. Madsen wrote:
>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?
AFAICT we could make it a syntax error iff foo is not used in void context;
Perl must be able to tell whether or not it is used in order to know what
context the result is in, right?
--
Peter Scott
Pacific Systems Design Technologies