On Mon, Oct 5, 2009 at 9:22 PM, Jim Burgess <jack.zelig / gmail.com> wrote: > Cheers for the replies, they are certainly very interesting and I will > work through all of them. > However, now I'm having weird problem. > > When I run the following on Linux: > a = ["a", "b", "a", "b", "b"] > > a.uniq.each do |elem| > puts "#{elem}\t#{a.count(elem)}" > end > > I get the expected output : > a 2 > b 3 > > But when I run exactly the same code on Windows I get: > > undefined method `count' for ["a", "b", "a", "b", "b"]:Array > (NoMethodError) > > ruby -v (Linux): ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] > ruby -v (Windows): ruby 1.8.6 (2009-09-24 patchlevel 111) [i386-mswin32] > > Does anyone have an idea why this could be happening. > I have tried searching for a solution with Google, but could find > nothing helpful. > > > -- The solution from Ryan Davis also works on Ruby 1.8.6 Check it out. Harry -- A Look into Japanese Ruby List in English http://www.kakueki.com/ruby/list.html