From: Robert Dober Date: 2007-02-28T02:57:44+09:00 Subject: Re: Comparing two arrays On 2/27/07, 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. Im getting a > weird result im getting the same values saying "not found" and without > the concatanation, can somebody please give me a hint of what is going > on. > > Thanks in advance. > > def handle_data(data1,data2) > c = 0 > t = 0 > result = [] > while c < data1.length > k = 0 > while k < data2.length > if data1[c].length > 7 > result[t] = data1[c].include?(data2[k]) ? data1[c] : > data1[c]+" NOT FOUND" > t += 1 > end > k += 1 > end > c += 1 > end > return result.uniq > end > > > -- > Grimoire Guru > SourceMage GNU/Linux > > If I understand correctly you want something like ary1.map{ |ele| ele.to_s << ( ary2.include?( ele ) ? "" : " NOT FOUND" ) } HTH Robert BTW did I read an article of you in the French Linux Mag recently? -- We have not succeeded in answering all of our questions. In fact, in some ways, we are more confused than ever. But we feel we are confused on a higher level and about more important things. -Anonymous