On Thu, Sep 07, 2000 at 10:05:58PM +0200, Bart Lateur wrote:
> On Fri, 8 Sep 2000 05:59:02 +1100 (EST), Damian Conway wrote:
>
> >But it makes "short-circuit as soon as C<grep>
> >lets through a specific value" ugly:
> >
> > my $seen;
> > $has_odd_elem = grep { $seen && last; $_%2 && ++$seen } @numbers;
>
> Not just ugly. Useless.
How about using 'return', then? That could, ahem, return both true and
false values. Yes, that does have semantics now...but can someone with
a straight face confess to having used that, e.g.
sub ... { ... grep { ... return; } ... }
--
$jhi++; # http://www.iki.fi/jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen