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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1060060]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2024-04-18 11:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found