I forgot to say, your command works for me on mac os x(unix):

$ cat data.txt
hello world
goodbye

$ r5test.rb data.txt | r5test.rb
hello world
goodbye

$
-- 
Posted via http://www.ruby-forum.com/.