Hi Monks, I ask for guidance in my request. I am writing a Java application that calls a Perl application. Among the parameters I'm passing to the called Perl is a String value of what is an octal number. In The Perl software I need to convert that back to octal. What I was considering doing is converting the String to decimal then to octal. Dec to oct is simple using sprintf, but how would I convert from String to decimal? Or is there a way to convert directly to octal? What I am converting is Linux File Permissions, in octal. I am using String to pass the arguments because I have a number of different arguments to pass into the Perl and a String array is the simplest, tidiest way of doing it - one array to be passed rather than several differing values. Perldocs does have a node on oct() - converting 'strings' to octal, however this appears to type 'strings' as integers rather than 'strings' as characters (which is what I will be dealing with).

In reply to Convert string to decimal to octal by patt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.