in reply to hex(unpack("H*")) help?!?!

If the input data is in network (big-endian) order, do this:
$number = unpack("n", $string);
If it's in little-endian order, do this:
$number = unpack("v", $string);
If it's in the order for the machine your perl is running on, you can do this:
$number = unpack("S", $string);
Or use a little 's' if you want signed data.

Replies are listed 'Best First'.
Re: Re: hex(unpack("H*")) help?!?!
by jettero (Monsignor) on Oct 31, 2002 at 17:17 UTC
    doh, it was right there all along... in perldoc -f pack I mean. God bless you. Thank you. May you live a 1,000 years... :)