From: joemacbusiness@... Date: 2008-12-25T02:01:19+09:00 Subject: newbie qusetion: read a file and print out same file Hi All, How do I read an input file and print it back to STDOUT exactly as the original file. This should be very simple but the output of my program is all garbled. What am I doing wrong? ( I am using http://www.rubycentral.com/book to learn Ruby) The program, input, and runtime output are below. Thanks, --JM ================= snip ============== $ cat ./test56.rb #!/usr/local/bin/ruby inputFile = File.readlines("input4", 'r') for item in inputFile item.chop() print item, "\n" end $ $ cat input4 car tree house candy bar paper ocean $ ./test56.rb car tr ee house candy bar paper ocean