hex
EXPR
This function interprets
EXPR
as a hexadecimal string and returns the equivalent decimal value. (To interpret strings that might start with
0
or
0x
see
oct
.) If
EXPR
is omitted, it interprets
$_
. The following code sets
$number
to 4,294,906,560:
$number = hex("ffff12c0");
To do the inverse function, use:
sprintf "%lx", $number; # (That's an ell, not a one.)