DelphiFAQ Home Search:

Using octal data


comments3 comments. Current rating: 2 stars (2 votes). Leave comments and/ or rate it.


Why isn't my octal data interpreted correctly?


Perl only understands octal and hex numbers as such when they occur as literals in your program. If they are read in from somewhere and assigned, no automatic conversion takes place. You must explicitly use oct() or hex() if you want the values converted. oct() interprets both hex ("0x350") numbers and octal ones ("0350" or even without the leading "0", like "377"), while hex() only converts hexadecimal ones, with or without a leading "0x", like "0x255", "3A", "ff", or "deadbeef".

This problem shows up most often when people try using chmod(), mkdir(), umask(), or sysopen(), which all want permissions in octal.

chmod(644,  $file);	# WRONG -- perl -w catches this

chmod(0644, $file);	# right 

Content-type: text/html


2020-06-26, 15:33:51
Denise from United Kingdom  
What's Happening i am new to this, I stumbled upon this I have discovered It positively helpful and it has helped me out loads.
I am hoping to give a contribution & help different users like its aided me.
Great job.
2020-07-02, 09:34:03
Geraldine from Uzbekistan  
clomid price cvs



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: