From: James Edward Gray II Date: 2006-09-27T01:44:13+09:00 Subject: Re: Ruby's equivalent of PHP explode On Sep 26, 2006, at 11:15 AM, Paul Lutus wrote: > As to the second, read an .ini file and break it down by line and by > name/value pairs (not tested): > > data = File.read("filename.ini") > > my_hash = {} > > data.each do |line| > key,value = line.split("=") > my_hash[key] = value > end No need to slurp a file so we can process it line by line. Also, the equals-in-value problem is just one more argument to split(): ini = Hash.new File.foreach("file_name.ini") do |line| key, value = line.split("=", 2) ini[key] = value end James Edward Gray II