How to convert from hex to signed integers in Perl? -


hi folks new perl. have hex chanel data(24 bits) 'fe284b' , '018263' want it's equivalent signed integers '-120757' , '98915' respectively. please me how in perl.

use hex()function convert hex string numeric equivalent. if value should have been negative, make so.

$hex = 'fe284b'; $value = hex($hex); $value -= 0x1000000 if $value >= 0x800000; print $value; 

output:

-120757 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -