Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2016-10-26 03:23 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (332 votes). Check out past polls.