Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: search and return values from an array

by Gtforce (Sexton)
on Feb 14, 2018 at 18:39 UTC ( [id://1209163]=note: print w/replies, xml ) Need Help??


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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1209163]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 17:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found