Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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...)


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

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 browsing the Monastery: (12)
As of 2014-09-19 05:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (129 votes), past polls