From: Peter Vanbroekhoven Date: 2005-09-02T00:14:16+09:00 Subject: Re: palindrome finder On Fri, 2 Sep 2005, Josh Charles wrote: > I've been working on this piece of code and it's starting to drive me > crazy. I think it's a problem with reference vs value type, but I'm > not sure. I'm just writing a simple program to process a list of > words and print out all the palindromes (words that read the same > forward and backward) > > Here is my code: > > file = File.open("testdict.txt", "r" ) do |file| > file.each_line("\n") do |line| > #filelist.push( line ) > line.downcase! line.chomp! > if (line == line.reverse) > puts line > end > end > end The newline is included and is removed by chomp. Peter