I am running Perl 5.8.0 on Linux. -----Original Message----- From: Randy W. Sims [mailto:[EMAIL PROTECTED] Sent: Sun 7/11/2004 11:01 AM To: Youssef Eldakar Cc: [EMAIL PROTECTED] Subject: Re: Packing a Hexadecimal String
On 7/11/2004 3:43 AM, Youssef Eldakar wrote: > I am trying to pack a hexadecimal string from a text file. I am using the H conversion with the pack function. Strangely, 0xC2 values are appearing in the resulting byte stream right before bytes whose value exceeds 0x7F. > > To illustrate, the following works as expected: > > $ perl -e 'print pack("H*","207F10")'|od -Ax -tx1 > 000000 20 7f 10 > 000003 > > However, replacing the "7F" with "80" in the pack function, results in the appearance of the "C2" in the dump: > > $ perl -e 'print pack("H*","208010")' | od -Ax -tx1 > 000000 20 c2 80 10 > 000004 Right now I'm on a Windows 2000 machine running perl 5.6.1. I get the expected: [X:\home\Administrator] $ perl -e "print pack('H*','207F10')" | od -Ax -tx1 000000 20 7f 10 000003 [X:\home\Administrator] $ perl -e "print pack('H*','208010')" | od -Ax -tx1 000000 20 80 10 000003 When I get a chance I'll check on my laptop which is running Debian GNU/Linux with perl 5.8.3. What are you running? Randy.