Right you are dvergin! There is indeed a CR character at the end.
I think I get what the problem is. My datafile came from a PC and thus has a CRLF in it. But since I am now running this on UNIX (migrating the app from Windows NT/2K to UNIX) chomp only gets rid of the LF and leaves the CR?
Guess the moral of the story is that straight substitutions are better than using chomp or chop!