in reply to Re^3: The most efficient way for searching for an element in an array?
in thread The most efficient way for searching for an element in an array?

2) No you cannot break map grep sort just because they are not loops!

L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^5: The most efficient way for searching for an element in an array?
by hotchiwawa (Scribe) on Jan 08, 2016 at 10:19 UTC
    in fact there is a loop (in sort, map, grep) but no internal checks to escape like single match...
      I dont know perl's internals but i think to those functions as 'list returner'. No loop is involved as in @array = qw(a b c); Can you brake the assignement after 'b' is reached? No. The same for map grep and sort.

      L*
      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
        For your amusement (I know you love tying):

        Update: fixed splice.

        Update 2: Acme::Array::MaxSize.

        ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,