From: Christopher Dicely Date: 2010-09-07T08:17:07+09:00 Subject: Re: Problem with 'chomp' On Mon, Sep 6, 2010 at 3:11 PM, Barry O'gorman wrote: > Simple program: > > while($_ != "q") >    puts "Running..." >    print "Enter q to quit: " >    gets >    chomp > end > > However - getting the following in any progams in which I use 'chomp': > 'undefined local variable or method 'chomp' for main: Object (NameError) At least in Ruby 1.9, Kernel#chomp only exists when the -n or -p command-line options are used when launching ruby, and mostly would only be used when you are putting the code all on the ruby command line. If you want to take lines from the programs input, chomp them, and send them (now run together) to the output until you hit a "q" by itself in the input, this should do the trick: ruby -p -e "chomp; $_ == 'q' ? break : $_"