From: Rafael George Date: 2007-02-28T03:42:44+09:00 Subject: Re: Comparing two arrays Ok, thanks now im trying to take out this from a anyline on the file ----- or [a-zA-Z] or # this is the code that im using, but the lines stays with something because my script parse that line. Another suggestion ? .delete("#[a-zA-Z]-").strip On 2/27/07, Phrogz wrote: > 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"] > > > -- Grimoire Guru SourceMage GNU/Linux