in reply to display problem

The following should show you what's giving you grief. (Either you have a non-printing character in your file, or your line terminator isn't what you think it is.) Put it in your code immediately after the chomp.

print sprintf( "Terminal %x\n", substr($song, -1) );