From: Ryan Mckenzie Date: 2011-07-21T05:53:13+09:00 Subject: Re: Splitting strings Hi Robert, Your example works perfectly, thank you! To incorporate the occurence count for each keyword do we need to put it into a hash similar to the first example I gave or is it possible to directly link that up with the output? The previous example I had was: words.each { |w| w.lstrip if h.has_key?(w) h[w] = h[w] + 1 else h[w] = 1 end } } # sort the hash by value, and then print it in this sorted order h.sort{|a,b| a[1]<=>b[1]}.each { |elem| puts "\"#{elem[0]}\" has #{elem[1]} occurrences" } Many thanks again for your help. Regards, Ryan -- Posted via http://www.ruby-forum.com/.