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

Re: Matching 2 unordered arrays then printing the first array highlighting the matches?

by thezip (Vicar)
on Oct 28, 2013 at 20:23 UTC ( #1060060=note: print w/replies, xml ) Need Help??


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
  • Comment on Re: Matching 2 unordered arrays then printing the first array highlighting the matches?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2018-11-19 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (210 votes). Check out past polls.

    Notices?