programming-ruby-1-9-2-0 中有一段代码的运行结果不对?

代码如下:

Song = Struct.new(:title, :name, :length)File.open("songdata") do |song_file|    songs = []    song_file.each do |line|        file, length, name, title = line.chomp.split(/\s*\|\s*/)        songs << Song.new(title, name, length)    end    puts songs[1]end

预期结果:

#

文件songdata在同目录下,内容如下:

jazzj00132.mp3   345  Fats     Waller      Ain't Misbehavin'jazzj00319.mp3   258  Louis    Armstrong   Wonderful Worldbgrassbg0732.mp3 409  Strength in Numbers  Texas Red

但是我运行的结果却是:

#

请问这是为什么呢?

programming-ruby-1-9-2-0 中有一段代码的运行结果不对?

相关文章:

你感兴趣的文章:

标签云: