Similarly, by using the < character instead of the > character you can redirect any input a Ruby script may read from the keyboard to read from a .txt file. It's helpful to think of these two characters as funnels; you're funneling output to files and input from files.
C:\scripts>ruby example.rb <input.txtto run them. Open your text editor and save the following program as test.rb. [blockquote shade=yes] #!/usr/bin/env ruby
print "What is your name? "
name = gets.chomp
puts "Hello #{name}!"

