Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Keep It Simple, Stupid
 
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 having an uproarious good time at the Monastery: (7)
As of 2014-04-16 11:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (424 votes), past polls