in reply to Re^3: convert to binary number
in thread convert to binary number

You were responding to my assertion that the integer was already in binary and could be printed in different bases with printf.

I was responding to your assertion that no conversion was required. I wasn't responding to your contradictory assertion that printf could perform the required conversion.

Replies are listed 'Best First'.
Re^5: convert to binary number
by Lotus1 (Vicar) on Jun 10, 2017 at 03:59 UTC
    I was responding to your assertion that no conversion was required. I wasn't responding to your contradictory assertion that printf could perform the required conversion.

    If an integer in memory is in binary and is displayed as binary by printf is there a conversion? If you are talking about converting strings that represent numbers from one base to another that would be something different since the OP specifically mentioned an integer.

    From your original response:

    No, it's not. It's a number, and the OP really does want to convert it to binary.

    You still haven't explained how you know what the OP really wants since they didn't specify. I would like to hear more about how integers in Perl are just numbers.

      I believe that what ikegami is driving at is that perl variables are not simple dwords and thus, while still having a binary representation, you can't simply print the dword. Rather, you always have to translate the underlying structure to any of the possible representations, including binary.

        I think "driving at" is a generous way to phrase it but I see your point. I need to remind myself that Perl is a high level language and is not the same as C. I've been trying to find more detail about how Perl stores variables and I finally found perlguts. Thanks.