Your build of Perl cannot hold numbers that big (48 bits).
my $num = hex(substr(("0"x12).$hex, -12, 4)) * 2**32 + hex(substr(("0"x12).$hex, -8));
Update: Added mention on Math::BigInt, Math::Int64 and Math::Int128.
Update: Fixed bug. (0x12 is not the same as "0"x12!)
In reply to Re: Hex to decimal resulting in integer overflow
by ikegami
in thread Hex to decimal resulting in integer overflow
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |