slurp a file into an array without newlines

D

Dick Davies

Coffee....not.....working.......

what's a neater way of doing this?

lines =3D File.new('sometextfile').readlines.map { |l| l.chomp }
 
G

Gavin Sinclair

Dick said:
what's a neater way of doing this?

lines = File.new('sometextfile').readlines.map { |l| l.chomp }

require 'rio'

lines = rio('sometextfile').chomp.lines[]

Gavin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top