Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: state and file perms confusion

by Kenosis (Priest)
on Aug 04, 2012 at 02:18 UTC ( #985374=note: print w/ replies, xml ) Need Help??


in reply to Re^2: state and file perms confusion
in thread state and file perms confusion

What am I seeing?

33188 decimal = 100644 octal (first printf) 07777 octal = 0000111111111111 binary (mask)-| +- & (bitwise AND) 33188 decimal = 1000000110100100 binary (mode)-| 0644 octal = 0000000110100100 binary (printf after mask) ^^^^ | + - file type masked out

How can store the number in a scalar rather than printing it?

use Modern::Perl; my $mode = 33188; my $modeResult = sprintf '%04o', $mode & 07777; say $modeResult; # prints 0644


Comment on Re^3: state and file perms confusion
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2015-07-29 04:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls