Unexpected kEND, expecting $

a = IO.readlines(‘testparsed’)

a.each do |groupname|
filename = groupname.chomp
File.open filename
puts data
end
end

Why does this give me: “parse error, unexpected kEND, expecting $” for
the line with the last ‘end’?

On 23/11/06, Comfort E. [email protected] wrote:

the line with the last ‘end’?


Posted via http://www.ruby-forum.com/.

File.open filename do

Farrel

On 11/23/06, Comfort E. [email protected] wrote:

a = IO.readlines(‘testparsed’)

a.each do |groupname|
filename = groupname.chomp

  • File.open filename
  • File.open filename do |file|
  • puts data
    
  • file.puts data # if writing to file is what want to do
    

Comfort E. wrote:

the line with the last ‘end’?

a.each do |groupname|
File.open(groupname.chomp,“w”) { |f| f.write data }
end