To read from the standard input, you can use STDIN as your fh.
var file =File(__FILE__)file.open_r(\var fh, \var err) || die "#{file}: #{err}"fh.each { |line|# iterates the lines of the fh line.each_word { |word|# iterates the words of the line say word }}