Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Unwanted Octal to Decimal Conversion

by borisz (Canon)
on Feb 18, 2004 at 20:56 UTC ( #330058=note: print w/replies, xml ) Need Help??


in reply to Unwanted Octal to Decimal Conversion

I can't see the real problem here.
#!/usr/bin/perl use constant GROUP_READ => 0040; use constant OWNER_READ => 0400; my $mask = GROUP_READ | OWNER_READ; printf "my mask is %04o", $mask;
Boris

Replies are listed 'Best First'.
Re: Re: Unwanted Octal to Decimal Conversion
by ambrus (Abbot) on Feb 18, 2004 at 21:02 UTC

    I recommend "%05o" or "%#04o" because permission are 12 bit long and this way there will always be a preceding zero to indicate octalness.

      You are right. then I like "0%04o". It is most readable for me.
      Boris

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://330058]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2017-12-16 00:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (447 votes). Check out past polls.

    Notices?