I'm trying to save file permissions with stat,
so I can restore permissions back to the file
after editing.
my $mode = (stat $open)[2];
#and then later
chmod $mode,$open;
The program is working, but it has caused
me to wonder what is going on with the octal permissions.
For instance, if I have a file with permissions 100500,
(stat file)[2] will report mode to be 33088.
Ok, I can understand that because 33088 = oct(100500)
but given the octal number 33088 what function do I use
to convert it to 100500? In other words what is the
procedure to do octal to decimal conversion?
Also, I thought that the 0500 style of given file permissions
IS octal.
So the docs tell me to do a chmod like this with octal values:
chmod 0500, file
but in my program I'm using 33088 as the octal value?
futher confusing the issue for me is that
oct(0500) = 208
8 is not supposed to be in the octal digit set of 0 to 7?
WTF??
Is there some easy to grasp perspective on this?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]