Tutorials Point


  Perl Home

  PERL Functions

© 2013 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL oct Function



Advertisements

Syntax

oct EXPR

oct


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

  • Decimal 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:

oct(88) 0
oct(0760) 496


Advertisements


  

Advertisements