On Sep 1, 2005, at 10:17 AM, Berger, Daniel wrote:

> IO.foreach("testdict.txt"){ |line|
>     line.downcase!.chomp!
>     puts line if line == line.reverse?
> }

No, don't do that.  ;)  The "bang" methods return nil when they don't  
change anything:

Neo:~$ cat testdict.txt
nothing
wow
Neo:~$ cat palidrome.rb
IO.foreach("testdict.txt"){ |line|
     line.downcase!.chomp!
     puts line if line == line.reverse?
}
Neo:~$ ruby palidrome.rb
palidrome.rb:2: private method `chomp!' called for nil:NilClass  
(NoMethodError)
         from palidrome.rb:1:in `foreach'
         from palidrome.rb:1

James Edward Gray II