From: Jim Burgess Date: 2010-05-01T22:32:41+09:00 Subject: Re: Reading lines from a file into an array Hi Jesus, Thanks for your reply. That really helped. > Usually parsing html with regular expressions is risky. I'd use a > parser instead, if possible, for example nokogiri: You are of course correct. I have followed your suggestion, installed 'nokogiri' and am currently looking at some examples. I will then tweak what you wrote and use that in my final version as it is very neat and concise. However, this: > doc.xpath('//tr[@class="odd"]/td').each_slice(2) do |first, second| > result << [first.inner_html, second.inner_html] > end gave me the idea of writing this: lines.each_slice(4){|one,two,three,four| result << [two.chomp,three.chomp]} which also does exactly what I want, so thanks again! Essentially, I have just finished reading the first part of the Pickaxe book and am trying to implement some of their suggestions and think about the code I write as opposed to doing the "quick and dirty" method. -- Posted via http://www.ruby-forum.com/.