From: "David A. Black" Date: 2008-05-02T05:16:17+09:00 Subject: Re: splitting with a regex & keeping a ref? Hi -- On Fri, 2 May 2008, Kyle Schmitt wrote: > David, > I don't mind it at all! > > Out of curiosity, agreeing that File.read().scan() is much cleaner, is > it just syntactic sugar for the same thing, or is it computationally > different? I don't know whether File.read is actually written in terms of File.open (I'm afraid I'm too lazy to check right now), but I think the underlying system calls etc. would be at least very similar. I expect File.read is slightly cheaper, since it doesn't involve the whole block structure. (I'm talking, of course, specifically about comparison with File.open {|f| f.read }, where you get the whole file at once.) David -- Rails training from David A. Black and Ruby Power and Light: INTRO TO RAILS June 9-12 Berlin ADVANCING WITH RAILS June 16-19 Berlin INTRO TO RAILS June 24-27 London (Skills Matter) See http://www.rubypal.com for details and updates!