From: "Alexandru E. Ungur" Date: 2009-02-16T23:03:39+09:00 Subject: Re: Hash :: Recursive traversing and stripping the values >>> sender: "vimal" date: "Mon, Feb 16, 2009 at 09:40:02PM +0900" << So is there any other way to carry out this stripping > functionality thoughout the hash(if nested too)!!! >>>EOQ Of course there is: elsif v.class == Hash strip_hash_values(hash) end should actually be: elsif v.class == Hash strip_hash_values(v) end Additionally, you could 'cheat' and use "case" (no more need to check the type/class manually): def strip_hash_values(hash) hash.each do |k, v| case v when String v.strip! when Array v.each {|vv| vv.strip!} when Hash strip_hash_values(v) end end end Cheers, Alex