Hi --

On Sun, 15 Jul 2007, SonOfLilit wrote:

>> I wasn't even aware that "foo = gets; foo.chomp!" would be more efficient
>> than "foo = gets.chomp" -- that's news to me, and I'm not sure I get why
>> that should be the case at the moment.  Even so, I tend to agree --
>> except in very limited circumstances, I think choosing the former over
>> the latter because of efficiency is a case of premature optimization.
>
> foo = gets.chomp! # eat the cake and leave it whole

That could get you into trouble:

   $ echo -n "abc" | ruby -e 'puts gets.chomp!'
   nil


David

-- 
* Books:
   RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242)
   RUBY FOR RAILS (http://www.manning.com/black)
* Ruby/Rails training
     & consulting:  Ruby Power and Light, LLC (http://www.rubypal.com)