Slitting at tabs still done the same way in 1.8?

Can anyone confirm that the way to parse a tab-delimited line in a text file in Ruby 1.8 is still as follows:

IO.foreach("./control/control_sp#{sp_num}.txt") { |x|
field = x.chop.split("\t")

Thanks.

-ke

Hi –

···

On Sat, 23 Aug 2003, Kurt Euler wrote:

Can anyone confirm that the way to parse a tab-delimited line in a text file in Ruby 1.8 is still as follows:

IO.foreach(“./control/control_sp#{sp_num}.txt”) { |x|
field = x.chop.split(“\t”)

I’d add a closing brace :slight_smile: Also, probably chomp is better than
chop, in case your last line doesn’t have a newline at the end.
Other than that I think it’s OK.

But I’m waiting for the other shoe to drop… It sounds like
something isn’t working for you. Is that right?

David


David Alan Black
home: dblack@superlink.net
work: blackdav@shu.edu
Web: http://pirate.shu.edu/~blackdav