Gets

Hi --

···

On Sun, 15 Jul 2007, Robert Dober wrote:

<snip>

That could get you into trouble:

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

David

Oh noooo
of course David is right, let me be just a little be more explicit
507/7 > irb
irb(main):001:0> 'ab'.chomp!
=> nil
that really hurts

I specifically wanted to provide a gets-based example, but it's
certainly rooted in the fact that chomp! returns nil if nothing has
changed.

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)