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

Re: fastest way to compare two arrays

by roboticus (Chancellor)
on Apr 14, 2011 at 15:23 UTC ( #899460=note: print w/replies, xml ) Need Help??

in reply to fastest way to compare two arrays


Two questions:

  1. Do you really need to use an array?
  2. Do you really need the lowest-numbered available port?

If the answer is no for both, you might consider using a hash to hold your free ports. So when you want to use a free port, just grab the first available one without sorting, and remove it from the "available" hash. When you're done with it, just return it to the hash.

If you must use an array, but don't need the lowest-numbered port, then just pop a port from your list, and when you're done with it, push it back on.


When your only tool is a hammer, all problems look like your thumb.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://899460]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2018-05-27 10:18 GMT
Find Nodes?
    Voting Booth?