> "Tanton" == Tanton Gibbs <[EMAIL PROTECTED]> writes:
Tanton> To change from decimal to octal, you can use sprintf with a %o format string
Tanton> my $val = sprintf( "%o", 8 );
Tanton> print $val;
Tanton> 10
No, this changes from a *number*, which you have typically typed
in decimal, to an
> "Michael" == Michael Fowler <[EMAIL PROTECTED]> writes:
Michael> Heh, you still have that backwards. oct() interprets its argument as an
Michael> octal value, and returns its decimal equivalent.
Interesting that you use "decimal" here...
Michael> Also, it's best not to think of functions
> "Zentara" == Zentara <[EMAIL PROTECTED]> writes:
Zentara> After putting on the dunce cap and typing 100 times:
Zentara> "the oct function takes a decimal value and returns octal,
Zentara> and (stat file)[2] returns a decimal value" I finally see it.
Zentara> I think I do anyways. :-)
No
On Thu, 14 Feb 2002 07:57:07 -0900, [EMAIL PROTECTED] (Michael Fowler) wrote:
>I'm tempted to say oct and sprintf's %o are symmetric, meaning they reverse
>each other. You can think of it that way if it helps, but it might confuse
>you in the case of oct(0500) and sprintf("%o", 0500).
Ok, I ha
On Thu, Feb 14, 2002 at 10:43:41AM -0500, zentara wrote:
> On Wed, 13 Feb 2002 15:14:39 -0900, [EMAIL PROTECTED] (Michael Fowler) wrote:
>
> >You have it backwards. Octal 100500 is 33088 in decimal. You just did the
> >conversion with the oct operator.
> >
> >You're confused about what oct does
On Wed, 13 Feb 2002 15:14:39 -0900, [EMAIL PROTECTED] (Michael Fowler) wrote:
>You have it backwards. Octal 100500 is 33088 in decimal. You just did the
>conversion with the oct operator.
>
>You're confused about what oct does; it returns the decimal representation
>of an octal value. Also, Pe
On Wed, Feb 13, 2002 at 05:20:38PM -0500, zentara wrote:
> Ok, I can understand that because 33088 = oct(100500)
> but given the octal number 33088 what function do I use
> to convert it to 100500? In other words what is the
> procedure to do octal to decimal conversion?
You have it backwards.
To change from decimal to octal, you can use sprintf with a %o format string
my $val = sprintf( "%o", 8 );
print $val;
10
- Original Message -
From: "zentara" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 5:20 PM
I'm trying to save file permissions with stat,
so I can restore permissions back to the file
after editing.
my $mode = (stat $open)[2];
#and then later
chmod $mode,$open;
The program is working, but it has caused
me to wonder what is going on with the octal permissions.
For instance, if I ha