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

oct

Interprets a string as an octal number, with automatic prefix dispatch.

Dispatches on prefix: 0x/x for hexadecimal, 0b/b for binary, 0o for explicit octal (Perl 5.34+), otherwise plain octal. Underscores are allowed as digit separators. Leading whitespace is stripped.

Synopsis

$val = oct("77");       # 63
$val = oct("0xff");     # 255 (hex)
$val = oct("0b1010");   # 10  (binary)
$val = oct("0o77");     # 63  (explicit octal)

See Also

hex