3
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

4

1 に答える 1