From: music Date: 2007-04-09T04:55:04+09:00 Subject: Re: what's the problem with array.include? Lyle Johnson wrote: > On 4/8/07, music wrote: > >> Here is my code: > > > >> @a.include?(mail) it seems don't work. >> I'm sure that there is at least one value true, but the result is always >> "not found". What is the problem? > > Is there any chance that there's some additional whitespace around the > e-mail address, either in the first file ("file.txt") or the log file > ("mail.log")? That would probably be enough to cause include? not to > find the match (since it's looking for an exact match). > here is some hash.key values from: @file=File.new("hash.txt", "w+") @hash.each_key {|x| @file.write x} this is the content of hash.txt: prova@azienda.itprova1@nonloso.it@utente1@azienda.it and @file=File.new("arr.txt", "w+") @a.each {|x| @file.write x} this is the content of arr.txt file: ancora@nonloso.itchi@azienda.itprova@azienda.it as you see prova@azienda.it is in hash and in arr then it is in @hash and in @a but @a.include?(value) it doesn't find it.