Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

hex

Interprets a hexadecimal string as an integer.

Accepts an optional 0x or 0X prefix. Underscores are allowed as digit separators. Leading and trailing whitespace is stripped. Returns 0 for empty or non-hex input.

Synopsis

$val = hex("ff");       # 255
$val = hex("0xDEAD");   # 57005
$val = hex("ff_ff");    # 65535

See Also

oct