--- name: hex status: documented runtime: pp source: src/runtime/pp/strings/convert.rs --- ```{index} single: hex; Perl built-in (pp runtime) ``` # hex ## Synopsis ```perl $val = hex("ff"); # 255 $val = hex("0xDEAD"); # 57005 $val = hex("ff_ff"); # 65535 ``` ## Description 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. ## See also oct