From: music Date: 2007-04-09T05:40:05+09:00 Subject: Re: what's the problem with array.include? Xavier Noria wrote: > On Apr 8, 2007, at 9:55 PM, music wrote: > >> 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. > > As I said before please inspect @a, its elements are not what you think. > As a hint > > puts @a.first.class This returns Array, it seems the correct answer I think. > > Then read the docs of String#scan to understand why you are after > something like > > @a.flatten.compact Great.....with @a=riga1.scan(/<(.*?@.*?)>|\(\?\)/).flatten.compact in place of @a=riga1.scan(/<(.*?@.*?)>|\(\?\)/) puts @a.first.class returns String and the code now works well. Sorry but I'm newbie on ruby, can you explain why it works now? Thank you.