6/8 Syntax error


puts "Enter text please: "
text = gets.chomp
words = text.split
words.each = {|word| frequencies[word] += 1 }
frequencies = frequencies.sort_by {|word, count| count}

This code gives me error:

(ruby):4: syntax error, unexpected '|', expecting '}'
words.each = {|word| frequencies[word] += 1 }
(ruby):4: syntax error, unexpected '}', expecting $end

"Oops, try again. It looks like you haven't set the frequencies hash correctly. Check the first exercise if you need help!"

Can someone tell me what is wrong here? I've tried everything!!


should be,

words = text.split(' ')
# or
words = text.split(" ")

That's the only obvious error. Try it and let us know.


Just tried it, didn't work. Any other ideas?


Update: this code works in Safari, but not in Chrome. Odd, but I'll take it so long as it means I wasn't screwing up!