in reply to Turning very larger numbers into an array of bits

Two questions key to helping you:

  1. Where are you getting these 80-bit numbers from? (How are you loading them into Perl?)

    This is important as no version of Perl can deal with 80-bit numbers as numbers.

    You could however, load them in their binary representation as binary strings of 10 bytes, and then accessing the bits directly is relatively simple.

  2. If you are loading them in binary (which is the only way) then you will need to know what format they are in.

    The only 80-bit numbers in common usage are the extended precision 80-bit IEEE 754 floating point values used internally by the X86 & X64 floating point processors. These have a fairly complicated format and are not directly interpretable bit by bit.

    If however, your numbers are simple 80-bit integers stored low bit first, once read from disk or stream, they would be directly interpretable in perl using its bit-wise string operations; or easily converted into an array of bits using unpack. eg:

    $bin80bit = "\x01\x23\x45\x67\x89\xab\xcd\xef\xaa\xff";; ## get an 80- +bit binary integer from somewhere. @bits = unpack '(a1)*', unpack 'B*', $bin80bit;; print scalar @bits, ':', "@bits";; 80 : 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 + 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 1 0 1 +0 1 0 1 0 1 1 1 1 1 1 1 1

    (I just do not know of any source of 80-bit integers.)

With answers to those questions, a solution to your question may be possible.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice.