Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: What does ">>" do? (And other stat questions)

by three18ti (Scribe)
on Nov 01, 2013 at 01:31 UTC ( #1060676=note: print w/ replies, xml ) Need Help??


in reply to Re: What does ">>" do? (And other stat questions)
in thread What does ">>" do? (And other stat questions)

Ok, I think this makes sense:

$dec_perms = (stat("filename"))[2] & 07777; $oct_perm_str = sprintf "%o", $perms;

You and the decimal value of file perms from stat against an octal number to get your decimal permissions. Then feed it to sprintf to get octal permissions.

But why "07777"? I'm sure there's a reason but it seems arbitrary (and perhaps they why is really moot...)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1060676]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2016-07-30 05:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (265 votes). Check out past polls.