Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: search and return values from an array

by Gtforce (Sexton)
on Feb 14, 2018 at 18:39 UTC ( #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 (Vicar) 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
Node Status?
node history
Node Type: note [id://1209163]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2018-08-18 17:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (185 votes). Check out past polls.

    Notices?