in reply to Hex string output

You probably need to unpack it if you want it rolled out to the stringified hex representation:

use strict; use warnings; open FILE, ">output.dat"; my $data = "\xff\x01\x67"; print FILE unpack("H*",$data); close FILE;

Update: Gulp... woops, you said you're using a hex editor, which presumably "unpacks" it to the stringified hex representation for you. Perhaps the problem is that you're saving it little-endian and reading it big-endian, or vice versa, in which case pack and unpack will still be helpful for converting back and forth.

UPDATE2: I was unable to replicate the problem you describe with the following code snippet:

use strict; use warnings; open FO, ">test.out"; my $data = "\xff\x01\x67"; print FO $data,"\n"; close FO; open FI, "<test.out"; while ( <FI> ) { chomp; print unpack("H*",$_), "\n"; } close FI;
So my suspicion is one of the following: your hex editor is malconfigured, or there is more being saved to the output file than illustrated in your example code snippet, or there's some sort of filesystem layer acting here based on a locale definition.


Dave


"If I had my life to do over again, I'd be a plumber." -- Albert Einstein