On Tue, Jul 31, 2001 at 11:34:14PM +0200, Marc A. Lehmann wrote:
> On Tue, Jul 31, 2001 at 12:34:16PM -0700, Paul <[EMAIL PROTECTED]> wrote:
> > > do {{EXPR; last}}
> > > forces void context on EXPR.
> >
> > 1) is the do{} necessary there?
>
> Yes, because of the last. I think it's pretty unintuitive to having to
> add the above uglyness around my last statement when I know it's the last
> statement.
Well, if all you want to do is force void context on the last statement
of a sub, you don't need any of this "uglyness". The do {{EXPR; last}}
is just a general way of forcing void context on an expression - even
in the middle of some other statement.
For subs, it's trivial:
Suppose you have:
sub foo {
....
EXPR
}
and want to force void context on EXPR. Write it as:
sub foo {
....
EXPR;
return
}
and you are done. No "uglyness". All you needed to do is adding an
explicite return so there are no implicite returns giving you an
unexpected context.
Abigail