>>>>> "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 octal string representation.  Compare yours
with this:

        my $val = sprintf "%o", 010;

There.  It's converting "octal to octal", using your incorrect language!

013 is a *number*, exactly the same number as 11 or 0xB or 0b1011,
using the Perl numeric literals.  None of them are "decimal".

The act of rendering a number to text defaults to decimal strings,
hence your (common) confusion.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to