in reply to Re: Re: An introduction to POE
in thread An introduction to POE
- I'm QUITE sure that using \012\015 is a bad idea ... \n\r has a chance of doing the right thing.
Um, I don't think so - Read the perlport man page under the heading "Newlines". To quote:
A common misconception in socket programming is that "\n"
eq "\012" everywhere. When using protocols such as common
Internet protocols, "\012" and "\015" are called for
specifically, and the values of the logical "\n" and "\r"
(carriage return) are not reliable.
print SOCKET "Hi there, client!\r\n"; # WRONG
print SOCKET "Hi there, client!\015\012"; # RIGHT
This is equally applicable to the use of the literal \r and \n in general programming.
perl -le 'print+unpack"N",pack"B32","00000000000000000000001001111000"'