You say 'little-endian' 32 bit values... so unpack('V30', $doc) is a good place to start, because that's 'little-endian' -- unpack('i30', ...) is a signed 'int', whatever size and byte order that might be.
As noted elsewhere, to get 3759263696 for the first 4 bytes (d0 cf 11 e0) implies these are unsigned 32 bit values. The 'V' pack/unpack form works unsigned. So there's a fit there.
Of course for -1 we now read 0xFFFF_FFFF.
If you really want signed integers, then you can convert all unpacked values >= 0x8000_0000. (This much is obvious.) With Perl v5.10 you can use 'l<' to pack/unpack a 32-bit signed little-endian value.
Update: you can also use 'V!' to pack/unpack a 32-bit signed little-endian value (also Perl v5.10).
(I don't know of a current machine that doesn't use 2's complement, so we need not worry about the form of -ve numbers !)
In reply to Re: To 'pack' or 'unpack' that is the question
by gone2015
in thread To 'pack' or 'unpack' that is the question
by Wiggins
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |