in reply to the chomp does not seem to work
If you're on linux $/ will be a line feed, but the CSV file could have the windows line endings CR LF (carriage return + line feed).
So you either need to adjust $/, or remove a bit more, for example all trailing spaces:
$line =~ s/\s+$//;
|
|---|