From: Anand Srinivasan Date: 2011-12-16T17:11:47+09:00 Subject: [array].include?(word) not working I tried running the code to remove stop words from text variable. The code does not remove the words from text variable based on the array variable stopwords. The output shows that the length of keywords and words are 11, which is not true. text = %q{Los Angeles has some of the nicest weather in the country.}; stopwords = %w{the a by on for of are with just but and to the my in I has some}; words = text.scan(/\W+/); keywords = words.select { |word| !stopwords.include?(word) }; puts "#{words.length} words"; puts "#{keywords.length} keywords"; -- Posted via http://www.ruby-forum.com/.