Is there something like `last` for `map`?

Viewed 1926

In Perl, is it possible to arbitrarily end a map execution, e.g. something equivalent to last in a loop?

It would be a bit like this:

map {
    if (test == true) { last; } dosomething
} @myarray
7 Answers
Related