Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
大家好,我是 Perl 的新手。我有一个十六进制香奈儿数据(24 位)“fe284b”和“018263”,我希望它分别是等效的有符号整数“-120757”和“98915”。请帮助我如何在 Perl 中执行此操作。
使用该hex()函数将十六进制字符串转换为其等效数字。然后,如果该值应该是负数,那就这样吧。
hex()
$hex = 'fe284b'; $value = hex($hex); $value -= 0x1000000 if $value >= 0x800000; print $value;
输出:
-120757