in reply to Re^2: display problem
in thread display problem

Maybe your line endings are not the same as $/?

The line endings on linux (LF), windows (CR LF) and Mac OS (CR? not sure...) are different, so if the input file has different line endings than your system, you have to set $/ to that value manually.

chop just removes the last character, independently of what it is.

The most generic solution might be $song =~ s/\s+$//, which removes all trailing whitespaces, and all line endings are considered to be whitespaces.

See perlvar for the meaning of $/.