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

vb.net - Alternative to the T-SQL AS keyword -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

ios - CFRelease causing crash in iPad application -