in reply to Re: Double While!
in thread Double While!

I recommend this solution.

A common error made by both beginners and experienced programmers alike is to compare arrays by, for each element in the one array, search the other array. This is OK for small amounts of data, but if the arrays have a thousand elements apiece, this is a million comparisons! (It scales quadratically.)

This is why Perl has hashes as a native data type, to make it easy to write efficient algorithms like Mirod did above. Basically whenever you find yourself thinking, "search" think about whether you can use a hash lookup instead. You cannot always, but whenever you can you will be rewarded with much faster code. (And in Perl it is often shorter as well.)