From: John Nott [mailto:JNott / dto.ie] 
# This seems to work very well thanks but the results are 
# produced in a long string. Is it possible to create these 
# figures as a matrix? (resembling something like excel)
# Thanks for your help.

i just modified 7studs's code,

C:\family\ruby>cat test.txt
1,2,3
4,5,6
7,8,9

C:\family\ruby>cat test.rb
results = []
ARGF.each do |record|
    results << record.split(",").map{|x| x.to_i}
end
p results
puts
s=results.size
s.times do |y|
  s.times do |x|
    print results[y][x],"\t"
  end
  puts
end


C:\family\ruby>ruby test.rb test.txt
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]

1       2       3
4       5       6
7       8       9

C:\family\ruby>ruby test.rb
1,2,3
4,5,6,7
8,9
10
^Z
[[1, 2, 3], [4, 5, 6, 7], [8, 9], [10]]

1       2       3       nil
4       5       6       7
8       9       nil     nil
10      nil     nil     nil

C:\family\ruby>

hth -botp