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'?

···

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

File.open filename do

Farrel

···

On 23/11/06, Comfort Eagle <steve@fooworks.com> wrote:

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'?

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

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

···

On 11/23/06, Comfort Eagle <steve@fooworks.com> wrote:

  end
end

Comfort Eagle wrote:

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'?

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

···

--
Paul Lutus
http://www.arachnoid.com