From: Daniel Carrera Date: 2003-02-13T05:50:49+09:00 Subject: Re: hm,... arr[1]["name"] On Thu, Feb 13, 2003 at 05:45:18AM +0900, daniel wrote: > $arr = Array(); > for( $i=0; $i<10; $i++ ) > { > $arr[$i]["name"] = "daniel"; > $arr[$i]["age"] = 20; > } > > This was php. > How to do this in ruby? arr = Array.new (0..9).each do |i| arr[i] = Hash.new arr[i]["name"] = "daniel" arr[i]["age"] = 20 end You could replace "Array.new" and "Hash.new" by "[]" and "{}" respectively if you prefer. -- Daniel Carrera Graduate Teaching Assistant. Math Dept. University of Maryland. (301) 405-5137