From: Torli Birnbauer Date: 2009-03-10T01:10:36+09:00 Subject: Re: Setting the contents of a file to a variable? badboy wrote: > did you read my post? why should we use a construct with a block if > there are several methods to do this directly? Because the block way is the Ruby way, besides it's much more efficient it does open, read and close in one short command! Beside it its elegance it also has a pedagogical value, namely, it highlights and exposes the use of Ruby 1.9 usage of Symbol class to_proc strategy. So all I can say is: Matthias, excellent contribution to this thread, very good job. Perhaps only a comment that even reading multi-line file into a variable sometimes can be useful with: guess = File.open("zorba.data", &:readlines) Clearly the old way in comparison to the the block is more like the spaghetti code! Torli -- Posted via http://www.ruby-forum.com/.