February 2012
Intermediate to advanced
1184 pages
37h 17m
English
hex EXPR
hexThis function interprets EXPR as a
hexadecimal string and returns the equivalent decimal value. A leading
“0x” is ignored, if present. To
interpret strings that might start with any of 0, 0b, or
0x, see oct. The following code sets $number to 4,294,906,560:
$number = hex("ffff12c0");To do the inverse function, use sprintf:
sprintf "%lx", $number; # (That's an ell, not a one.)
Hex strings may represent integers only. Strings that would cause
integer overflow trigger a warning. Unlike oct, leading whitespace is not
stripped.
Read now
Unlock full access