in reply to Re: Constructing 32-bit hexadecimal integers
in thread Constructing 32-bit hexadecimal integers


I didn't explain this very clearly, sorry.

A set of 1, 2, 3 or 4 hex values are stored in one variable. If you printed the variable, you'd get whatever ASCII characters corresponded to the hex values. (There's probably a better way to explain this, but I don't really speak the language quite yet.)

Should I split() the variable, then sprintf, then concatenate?

Thanks once more...

---
donfreenut
  • Comment on Re: Re: Constructing 32-bit hexadecimal integers

Replies are listed 'Best First'.
Re:{3} Constructing 32-bit hexadecimal integers
by jeroenes (Priest) on Apr 12, 2001 at 00:26 UTC
    Nah, use unpack at will.

    You will have to pad them missing values:

    $a = "\001"; #just another hex string $a = ("\000" x (4-length($a))).$a; #Zero pad that string print unpack 'L', $a; #Hey, that's one!

    Jeroen
    "We are not alone"(FZ)

      Well, it is either 1 or 0x01000000, depending on your platform. Use 'N' or 'V' in place of 'L' if you want to use big- or little-endian format (respectively) regardless of your current platform.

              - tye (but my friends call me "Tye")