2010/1/13 Brian Candler <b.candler / pobox.com>: > Robert Klemme wrote: >> I would do >> >> $stdin.each do |line| >> line.chomp! >> puts "I got #{line} !!" >> end >> >> because that is the more Ruby typical idiom for iterating all lines. > > Use #each_line if you want to do that. Ruby 1.9 removed #each from > Strings, but strangely decided to leave it on Files. To be safe, don't > assume that 'each' means 'each line'. Hmm, both #each and #each_line work on 1.8.7 and 1.9.1. But you're right, #each_line is more to the point. Thanks for the heads up, Brian! Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/