From: Tomasz Wegrzanowski Date: 2001-12-30T08:53:06+09:00 Subject: [ruby-talk:29671] Re: comma-delimited to an array On Sun, Dec 30, 2001 at 08:37:31AM +0900, Dash Riprock wrote: > > I'm quite new to Ruby, so please be gentle. > > I've got a file in which each line has comma-delimited items. A > sample might look like this: > > num,date,time,orig,type,action,rule,iface > 1,28Dec2001,23:59:51,121.210.49.22,log,accept,16,eth-s1p2c0 > 2,28Dec2001,23:59:44,121.210.48.11,log,drop,20,eth-s1p1c0 > 3,28Dec2001,23:59:57,121.210.49.22,log,accept,16,eth-s1p1c0 > > Because the order of the items may *vary* from day to day, I want to > treat each line as an array. > > But the question is, as I read each line, how do I convert that > single line into an array? > > I've tried quite a number of things and I can't figure it out. array=line.split(",")