in reply to Re: Improve foreach with help of map?
in thread Improve foreach with help of map?

No need for an eval or a sub. A block will do:
$ perl -wE '{map {say; last if /3/} 1..5}' 1 2 3

Replies are listed 'Best First'.
Re^3: Improve foreach with help of map?
by ikegami (Patriarch) on Oct 09, 2009 at 14:47 UTC
    { map { say; last if /3/ } 1..5 }
    is a contortionist's way of writing
    for (1..5) { say; last if /3/ }
    A reply falls below the community's threshold of quality. You may see it by logging in.