On 04/11/2002 20:52:02 Joseph P. Discenza wrote:

>Scott Carr wrote, on
>: The problem.  I have a Hex string like
>: 54686973206973206120746573740d0a546f2073656520686f772077656c6c20
>:
>: I want to convert it to its binary representation.  I am using a
>: command like pack("H*", $hexstring) to get the binary from this string.
>:
>: The issue.  Instead of having your normal Carriage Return Line Feed as
>: designated by the 0d0a hex code, I am seeing 0d0d0a returned by
>: pack.  It is adding another Carriage Return to the string.
>
>Where does this string come from? And where is it going to that you "see"
>the extra CR?
>
>Perl does the "right thing" by translating any "end of line" ("\n",
usually)
>to a Windows "end of line" ("\r\n") when outputting to a file. If you
don't
                                          ^^^^^^^^^^^^^^^^^^^^
>want that, you have to binmode(OUTFILE) after opening your output file,
but
>before writing to it.
>

Congratulations to Joseph P. Discenza for a working implementation of
PSI::ESP. There is no mention of writing to a file anywhere in the original
mail, yet he still managed to correctly diagnose the trouble spot.

Please post your implementation to CPAN :-)


--
Csaba Ráduly, Software Engineer                           Sophos Anti-Virus
email: [EMAIL PROTECTED]                        http://www.sophos.com
US Support: +1 888 SOPHOS 9                     UK Support: +44 1235 559933


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to