On Tue, 15 Jun 2004, Robert Klemme wrote:

> "Sven Schott" <sven_schott / compnow.com.au> schrieb im Newsbeitrag
> news:CBD4166F-BE86-11D8-B72B-000A9571732E / compnow.com.au...
> > I was actually just about to ask that. This was how I did it(pretty
> > much the same way as yours).
> >
> > file = File.open("file.csv", "r")
> > arr =[]
> > file.each { |i| arr << i.chomp.split(/\t/) }
> 
> This can be nicely done with a one liner:
> 
> arr = File.open("file.csv") {|io| io.inject([]) {|a, line| a <<
> line.chomp.split(/\t/)} }

#inject is somewhat scary...

  arr = File.open("file.csv") {|io|
    io.map {|line| line.chomp.split(/\t/)}
  }

-- 
Relm