Ok, so there's a confusion what the end of line is here. The telnet client is sending a CRLF, and when you chomp it, you end up (for some reason) with only the CR. You could try messing with $/ to get chomp to cut off both chars. See
perlvar for more details.
-- Dan