Daniel (>), Carl (>>):
>> The above reasoning raises the following question for me: how do I
>> return from a sub or a method from within a map block?
> I suppose what you want can be achieved with "last", it probably should
> work in "map" as well, since "map" and "for" are synonims...

That is all good and well for exiting the map itself; but what I want
to achieve is to exit the surrounding sub or method block. Example:

sub foo {
   my @a = map {
      return if $condition; # return from &foo
   }, @a;

Except that, as you explained, the above will not return from &foo,
but only from the map call. How would I return from &foo?

// Carl

Reply via email to