in reply to Problem with integer to decimal conversion

As talexb says, it would be helpful if you told us why you are doing this.

Because of the way you state the question, it seems that you may be under the impression that there is such a thing as a binary value as distinct from a decimal value. That is not the case. Inside Perl, a numeric value is just a numeric value.

So what you are doing only applies to the display of a value or the representation of the value as a string consisting of a series of '1' characters and '0' characters -- which is different from actual binary bits.

And that may be exactly what you need. But you don't tell us how this gets used, so it is hard to give you a more helpful response.

  • Comment on Re: Problem with integer to decimal conversion