Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL oct Function
Syntax
Definition and Usage
Converts EXPR from octal to decimal. For example, oct('0760') will return '496'. You can use the string returned as a number because Perl will automatically convert strings to numbers in numeric contexts.
Passed parameter should be an octal number otherwise it will produce zero as a result.
Return Value
Example
Try out following example:
#!/usr/bin/perl -w
print("oct(88) ", oct('88'), "\n");
print("oct(0760) ", oct('0760'), "\n");
|
It will produce following results:
|

|
|
|