From: John Fink Date: 2006-07-20T02:38:35+09:00 Subject: maybe I don't understand the .to_a method... ------=_Part_68433_11202215.1153330713196 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hey folks, I'm attempting to write a little program that uses the Net::HTTP library to fetch a text file. The text file has lines broken up by newlines, and I thought I could use the .to_a method to convert a variable into an array, but when I do it it puts the entire text file into the first marker on the array, and the rest are nil. Here's the program. I know I'm missing something grotesquely obvious, and thanks in advance for beating me with the clue stick. What I expected was for test to return what it returns, but test2[0] to return "This" and test2[1] to return "is". Test2[0] returns identical results to test. jf --- require 'net/http' require 'uri' filename = 'test.txt' def testget(filename) url = URI.parse('http://vineland.lib.muohio.edu/' + filename ) req = Net::HTTP::Get.new(url.path) res = Net::HTTP.start(url.host, url.port) {|http| http.request(req) } end test = testget(filename) test2 = test.to_a puts test puts test2[0] puts test2[1] ------=_Part_68433_11202215.1153330713196--