http://www.perlmonks.org?node_id=987669


in reply to Re^3: Best technique to code/decode binary data for inter-machine communication?
in thread Best technique to code/decode binary data for inter-machine communication?

some would never see a "\n" since they're really looking for "\r\n"

No, lack or presence of a "\r" is not going to mess up line-oriented I/O on any version of Perl1. Perl on Windows has no problem reading files that lack "\r" characters. Perl on Unix has no problem reading files that contain "\r" characters (it just includes the "\r" in the returned string).

But a common mistake with using sockets with Perl is using <$sock>, which will hang forever until a newline or end-of-file arrives. (Using print on a socket shouldn't to be a problem as sockets shouldn't default to buffered mode.)

1 Now that ancient Mac Perl's mistake of psuedo ASCII is history. But avoiding binmode wouldn't help in that case anyway.

- tye        

  • Comment on Re^4: Best technique to code/decode binary data for inter-machine communication? (newlines)
  • Select or Download Code