Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

perlfunc:oct

by gods
on Aug 24, 1999 at 22:42 UTC ( #261=perlfunc: print w/replies, xml ) Need Help??

oct

See the current Perl documentation for oct.

Here is our local, out-dated (pre-5.6) version:


oct - convert a string to an octal number



oct EXPR

oct



Interprets EXPR as an octal string and returns the corresponding value. (If EXPR happens to start off with 0x, interprets it as a hex string instead.) The following will handle decimal, octal, and hex in the standard Perl or C notation:

    $val = oct($val) if $val =~ /^0/;

If EXPR is omitted, uses $_. This function is commonly used when a string such as 644 needs to be converted into a file mode, for example. (Although perl will automatically convert strings into numbers as needed, this automatic conversion assumes base 10.)


Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[oakbox]: but there are a billion links 'out there' linking to search.cpan.org.
[marto]: yep :)
[Discipulus]: being her marto, can you explain what "Par for the course I'm afraid." means?
Discipulus here..
[marto]: "what is normal or expected in any given circumstances."
[marto]: better: "If a type of behaviour, event, or situation is par for the course, it is not good but it is normal or as you would expect"
[Discipulus]: thanks i was unable to decide where to split the sentece
[marto]: FWIW search.cpan rarely has issues, see http://noc.perl. org for a route to report problems
[oakbox]: thanks, marto.
[marto]: there was a period where search.cpan had some frequent outages for (IIRC) a couple of weeks. I've not had any problems since, until today.

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2017-07-26 10:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (388 votes). Check out past polls.