http://www.perlmonks.org?node_id=1060060


in reply to Matching 2 unordered arrays then printing the first array highlighting the matches?

Here's my offering:

  1. Stringify and hashify the smaller array (set the value to '1' for each key)
  2. Iterate through the stringified keys of the larger array, doing an exists() for each value to see if it exists in the smaller array
  3. If it exists, print "Matches'"
  4. If it doesn't, print "Doesn't match"

What can be asserted without proof can be dismissed without proof. - Christopher Hitchens, 1949-2011