def write_value(to, key, value)
      return to if key.nil? or key == ""

      prev = nil
      key.split(/\./).reverse.each {|x|
        a = Hash.new
        a[x] = if prev.nil? then value else prev end
        prev = a
        a
      }

      to.merge_recursive(prev)
    end
def write_value(to, key, value)
      return to if key.nil? or key == ""

      prev = nil
      key.split(/\./).reverse.each {|x|
        a = Hash.new
        a[x] = if prev.nil? then value else prev end
        prev = a
        a
      }

      to.merge_recursive(prev)
    end
Overwrite an existing +key+ whose format is "foo.bar" (where a dot
 represents one level deep in the hierarchy) in hash +to+ with +value+.
 If the key does not exist, it will be added at the appropriate depth level