From: Bart Lateur [mailto:[EMAIL PROTECTED]]
>
> On Wed, 06 Sep 2000 13:04:51 -0500, David L. Nicol wrote:
> 
> >       grep { $a > $_ and last } @b)
> 
> So "last" should return true, or what?

The last operator doesn't return anything does it? It immediately exits the
loop/block in question.

@passed = grep { 2 > $_ and last } (1, 2, 3, 2, 1);

I believe that unless used with a label, if someone were to use last within
a grep or map block, then further processing for that element of the list
which grep is working on would be skipped, and it would continue with the
next element.

would leave 
@passed = (1, 2)

instead of the current behaviour which would be
@passed = (1, 2, 2, 1) 

You can also do:

{
 last;
}

We are already advised not to use last within eval {}, sub {}, do {}, grep
{}, and map {}, but this might break some obfuscated code which depends on
it. I'm not to sure how this could be handled in a Perl 5->6 translation... 


to exit a block...

Hmm... I guess I'll submit and RFC on this... 

Garrett

Reply via email to