Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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 chilling in the Monastery: (3)
As of 2019-01-22 21:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    After Perl5, I'm mostly interested in:
































    Results (392 votes). Check out past polls.

    Notices?