From: Phrogz Date: 2007-02-28T03:15:11+09:00 Subject: Re: Comparing two arrays On Feb 27, 10:41 am, "Rafael George" wrote: > Hi, im trying to compare two arrays and creating a new one with the > values that are in the second array and the values that aren't > concatenated with "NOT FOUND", here is the snippet code. Ruby makes it quite easy to find out which elements from one array aren't in the other: irb(main):001:0> a = [ 'a', 'b', 'c', 'd' ] => ["a", "b", "c", "d"] irb(main):002:0> b = [ 'c', 'b', 'd', 'e' ] => ["c", "b", "d", "e"] irb(main):003:0> a - b # Items from a not in b. => ["a"] irb(main):004:0> b - a # Items from b not in a. => ["e"] irb(main):006:0> a | b # Items shared between both. => ["a", "b", "c", "d", "e"]