in reply to Re: search and return values from an array
in thread search and return values from an array

Many thanks, Thanos (runs way faster than what I expected)

  • Comment on Re^2: search and return values from an array

Replies are listed 'Best First'.
Re^3: search and return values from an array
by thanos1983 (Parson) on Feb 15, 2018 at 12:06 UTC

    Hello again Gtforce,

    Since you are also interested in speed and resources here is a small Benchmark measurement including three different ways of resolving your problem:

    A minor note here, if you use while loop it is a bit faster than foreach loop but it destroys the array.

    In conclusion on this case map looks to be the best option and it can be put it like this on a function:

    Hope this helps, BR.

    Seeking for Perl wisdom...on the process of learning...not there...yet!