From: Kev Jackson Date: 2005-10-04T14:16:03+09:00 Subject: Re: Odd hash behaviour Vance A Heron wrote: >Kev, >Seems to work for me ... >$ irb >irb(main):001:0> @min_pks = Hash.new() >=> {} >irb(main):002:0> key = 'MID' >=> "MID" >irb(main):003:0> @min_pks[key] = 1 unless @min_pks.has_key?(key) >=> 1 >irb(main):004:0> @min_pks[key] = 2 unless @min_pks.has_key?(key) >=> nil >irb(main):005:0> p @min_pks >{"MID"=>1} >=> nil > >Could you give the rest of your code and possibly some sample >data? > > Actually it was working, but when printing out the values, it prints everything (ie including things that shouldn't have been in the Hash). I figured it all out in the end, my logic was a little twisted and the print was always executing (hence my confusion), the Hash was behaving perfectly. As for the Set using require 'Set' That's the problem with not having docs for 1.8.2, the only docs I have cover 1.6 (and not too much of that). Suppose I'll have to get Pickaxe 2 :) Kev