in reply to How do I unpack a signed long in big endian?
$val = unpack( "N", $raw ^ "\x80\0\0\0" ) - ( 1 << 31 ); [download]