2
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
Вы видели это [SO-Question1] (http://stackoverflow.com/questions/12041492/ruby-whats -the-difference-between-stdin-gets-and-gets-chomp) и [SO-Question2] (http://stackoverflow.com/questions/10523536/whats-the-difference-between-gets-chomp-vs- stdin-gets-chomp) –
http://stackoverflow.com/questions/10523536/whats-the-difference-between-gets-chomp-vs-stdin-gets-chomp имеет ответ с точной разницей. –