From: Christian Szegedy Date: 2003-01-29T02:42:28+09:00 Subject: Re: Use mulit-dim. Arrays? [Questions from a Ruby Newbie (file io and d ata structures)...] christopher.j.meisenzahl@citicorp.com wrote: > > > I know I can read each line and split it after I read it. But I'm not sure how > to populate my arrays? Should I use one array for each column? If so, how do I > create the correct number of arrays (and name them appropriately) at runtime? Have not you read my previous mail? I answered all your question with 2 lines of ruby code. I have forgotten chomp, so that is it: a = [] IO.foreach { |l| l.chomp.split(",").each_with_index{ |s,i| (a[i] ||= []) << s } } a[i] is an array conatining the strings in the i-th column.