in reply to Matching 2 unordered arrays then printing the first array highlighting the matches?
Here's my offering:
- Stringify and hashify the smaller array (set the value to '1' for each key)
- Iterate through the stringified keys of the larger array, doing an exists() for each value to see if it exists in the smaller array
- If it exists, print "Matches'"
- If it doesn't, print "Doesn't match"
What can be asserted without proof can be dismissed without proof. - Christopher Hitchens, 1949-2011
|
---|
In Section
Seekers of Perl Wisdom