How do I convert from octal to decimal

Using Perl's built in conversion of numbers with leading zeros:

    $int = 033653337357; # note the leading 0!
    $dec = sprintf("%d", $int);
Using the oct function:

    $int = oct("33653337357");
    $dec = sprintf("%d", $int);
Using Bit::Vector:

    use Bit::Vector;
    $vec = Bit::Vector->new(32);
    $vec->Chunk_List_Store(3, split(//, reverse "33653337357"));
    $dec = $vec->to_Dec();


Back to perlfaq4