Reference: oct (Perl in a Nutshell)

Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: Reference: noChapter 5
Function Reference
Next: Reference: open
 

oct

oct ostring

Interprets ostring as an octal string and returns the equivalent decimal value. (If ostring happens to start off with 0x, it is interpreted as a hex string instead.) The following will handle decimal, octal, and hex in the standard notation:

$val = oct $val if $val =~ /^0/;
If ostring is omitted, the function interprets $_. To perform the inverse function on octal numbers, use:
$oct_string = sprintf "%lo", $number;


Previous: Reference: noPerl in a NutshellNext: Reference: open
Reference: noBook IndexReference: open

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.