in reply to Re^2: Turning 0755 into rwxr-xr-x
in thread Turning 0755 into rwxr-xr-x
Er, well you would be right if you weren't missing the fact that the mode here is actually an octal number that has to begin with a zero in Perl - that is to say 0755 will work fine whereas the 755 will not.
This is probably even easier to understand if you do:
Where the 07777 is a mask to remove the filetype information from the mode (as described in perlfunc).my $mode = (stat('.'))[2] & 07777; print $mode ,"\n"; printf "%o\n", $mode ; print mode_to_string($mode);
/J\
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Turning 0755 into rwxr-xr-x
by Nkuvu (Priest) on Aug 11, 2005 at 18:11 UTC |