From: Al Cholic Date: 2007-07-28T12:39:41+09:00 Subject: Re: How to delete array element and add to previous element Morton Goldberg wrote: > On Jul 27, 2007, at 8:08 PM, Al Cholic wrote: > >> data << (recd = row) >> always >> return false because there are no empty lines in the raw text file. > > row = line.chomp.split("\t") > > transforms one line of bom from a tab delimited record into an array > of fields. row[0] holds the contents of the first field. If that > content is an empty string, code will assume the line being processed > is a spill-over line. If it is not empty, code will assume the > beginning of a new record. The only line that I have trouble understanding is this one: if row[0].empty? I try to logically think about it. Lets say it hits a spill-over line and it has to process the string "C22,C23,C26,C27". So it chomps it at divides it up by tabs, which there are none because the chomp removed them if there were any. So, now row is a one element array. At this point I think row[0]="C22,C23,C26,C27" and row[1]=nil, row[2]=nil. Where is my logic flawed? Whats the difference between chomp and strip. I've only been using strip. Thanks again. -- Posted via http://www.ruby-forum.com/.