You could also use Math::BigInt:
#!/usr/bin/perl use Math::BigInt; my $hex = "0x000fffff7f00fffc"; my $dec = Math::BigInt->new($hex); print "$hex = $dec\n"; # also works with even larger numbers... $hex = "0x000fffff7f00fffc000fffff7f00fffc000fffff7f00fffc000fffff7f00 +fffc"; $dec = Math::BigInt->new($hex); print "$hex = $dec\n"; __END__ 0x000fffff7f00fffc = 4503597463175164 0x000fffff7f00fffc000fffff7f00fffc000fffff7f00fffc000fffff7f00fffc = 2 +826953945157987506191153074870519081847080605839924685569054791495483 +3916
Update: maybe it's worth noting that $dec is treated as a number internally (as opposed to a simple string representation of it), i.e. you can calculate with it. The respective operators are overloaded.
In reply to Re: Is there a 64-bit hex()?
by almut
in thread Is there a 64-bit hex()?
by kornerr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |