patt has asked for the
wisdom of the Perl Monks concerning the following question:
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).