From: Corey Konrad <0011@...> Date: 2007-03-16T06:26:27+09:00 Subject: Re: chomp Nexos wrote: > On Mar 15, 9:15 pm, Corey Konrad <0...@hush.com> wrote: >> >> but according to the author that isnt supposed to work, am i missing >> something or is the author incorrect? >> >> Thanks >> >> -- >> Posted viahttp://www.ruby-forum.com/. > > > "chomp" can be used on *any* string. > > If used without a target object, the $_ variable is used. > In your particular case, $_ is filled by the call to "gets". > > Regards, > > Fr�d�ric Delanoy The author of the book emplains that in order to make chomp work with a variable the way i did i would have to do it like this print "Please enter the temperature: " temp = gets $_ = temp chomp temp = $_ puts "The temperature is #{temp}." i just dont understand why the author would make things so convoluted like that. -- Posted via http://www.ruby-forum.com/.