Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: fastest way to compare two arrays

by krusty (Hermit)
on Apr 14, 2011 at 00:21 UTC ( #899316=note: print w/ replies, xml ) Need Help??


in reply to fastest way to compare two arrays

So my brain hurt, but 2 seconds after I posted, I had an idea...

@hash{@range} = (1) x @range; #guess I don't need to replicate now. delete @hash{@ports}; @open = sort {$a <=> $b} keys %hash; #seems to work
I'd guess so, but until I Benchmark I don't know if its more efficient, but at least I can read it easier. If there are better ways out there, please share.

Regards,
Kristina


Comment on Re: fastest way to compare two arrays
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (20)
As of 2015-07-07 22:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls