Hi,
Among other data, a binary file contains the bytes "00A5".
I am trying to read these four bytes and get the decimal equivalent as
follows:

..
$buf;
$hex_val;
$dec_val;
read(FD, $buf, 4);      #### $buf -> "00A5"
$hex_val = unpack("H*", $buf);
$dec_val = hex($hex_val);
...

Is there a way in which I can avoid the usage of unpack and directly get
the decimal value?

Also, "H" is for bigendian systems and "h" is for littleendian systems.
This is another reason why i want to avoid unpacking.

Thanks.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to