Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2016-12-03 13:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (56 votes). Check out past polls.