From: Alan Forrester Date: 2012-11-29T04:34:11+09:00 Subject: Re: sorting data from a file On 28 Nov 2012, at 19:15, 7stud -- wrote: > Alan Forrester wrote in post #1086915: >> >> In your script, read the file into an array using >> myarray = IO.readlines("myfile.txt") >> > > Why would you suggest that? What's the matter with the method: > > IO.foreach(fname) {|line| #code here} I think the problem for somebody who knows very little Ruby will be filling in the "code here" part of that prescription without ever looking the object to which he is applying the code. Alan