I am new to ruby and have the following code that reads in a file, then places the symbols separated by a '|' sign into different attributes of a Struc data type:
Song = Struct.new(:title, :name, :length)
song_file = File.new("songdata.txt")
songs = 
song_file.each_line do |line|
file, length, name, title = line.chomp.split(/\s*\|\s*/)
songs << Song.new(title, name, length)
/jazz/j00132.mp3 | 3:45 | Fats Waller | Ain't Misbehavin'
/jazz/j00319.mp3 | 2:58 | Louis Armstrong | Wonderful World
/bgrass/bg0732.mp3| 4:09 | Strength in Numbers | Texas Red
The problem should be related to line endings. Ruby seems to handle Windows and Unix line endings all right, but would only read the first line when you change your file's line ending to OSX's ("Mac OS 9" in SublimeText).
Change line endings of your
songdata.txt to Unix or Windows.