From: Ryan Davis Date: 2013-01-29T18:24:33+09:00 Subject: Re: Please explain in English On Jan 28, 2013, at 10:01 , Joel Pearson wrote: > def count_words(string) > res = {} > string.downcase! > string.scan( /\w+/ ).uniq.each{ |word| res[word] = > string.scan(/\b#{word}\b/).size } > res > end This modifies the argument coming in. Don't ever call downcase! or other mutating methods on an argument or you'll wind up in debugging hell. Make a copy instead: string = string.downcase