On Mar 15, 9:15 pm, Corey Konrad <0... / hush.com> wrote: > Hello > > I am reading a book right now on ruby on rails and the author says that > you can only use chomp with the built variable which is $_ > > i am confused because it seemed to work fine when i used it like this > > print "Please enter the temperature:" > temp = gets > puts "The temperature is #{temp.chomp}." > > 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ņÅņĶic Delanoy