From: Mark Probert Date: 2004-08-22T07:45:47+09:00 Subject: Re: Ruby way to update file lines "Robert Klemme" wrote in news:2opvm8FddmmgU1@uni-berlin.de: > > They are meant to be constants because they *are* constant. I just > put both variants into a single file but you'll likely need only one > of them, don't you? > When I leave them as constants, Ruby complains with the following error: deln.rb:37: dynamic constant assignment COMMENT = lambda {|key, val| "# #{key}:#{val}" } ^ In the end, it worked out well. My code snippet looks like: # create a function map for the items we want to delete comment = lambda {|key, val| "# #{key}:#{val}" } delete = lambda {|key, val| nil } checkmap = {} @nodelist.each do |n| key = "#{n.name}:#{n.ip}" checkmap[key] = (@remove) ? delete : comment end Where I now have the option of making the deletion permanent or just commenting it out. Which is perfect for my application. Regards, -mark.