in reply to Re^4: 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?

in fact there is a loop (in sort, map, grep) but no internal checks to escape like single match...
  • Comment on Re^5: The most efficient way for searching for an element in an array?

Replies are listed 'Best First'.
Re^6: The most efficient way for searching for an element in an array?
by Discipulus (Canon) on Jan 08, 2016 at 10:39 UTC
    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,