filename = ARGV.first
txt = open(filename)
puts "Here's your file #{filename}:"
print txt.read
print "Type the filename again: "
file_again = $stdin.gets.chomp
这是我的问题,如果我将其更改为gets.chomp
它不起作用,为什么?
txt_again = open(file_again)
print txt_again.read
gets.chomp
和有什么区别$stdin.chomp