perl CGI (3)
Visual Basic (1)
About this site
Links to us
General :: Programming :: perl
General questions about perl.
This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Recommended links on this topic:
Generated 8:03:14 on Feb 20, 2019
Using octal data
Question: Why isn't my octal data interpreted correctly?
Answer: 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.
|Most recent comments