in reply to How to unpack numbers with varying sizes?

I'm sure there's a more efficient and succinct method, but this should work:
# my $bytes = read ... my $bitstring = unpack 'B*', $bytes; $bitstring = sprintf '%.64d', $bitstring; my $num = unpack 'Q', pack 'B*', $bitstring;

Replies are listed 'Best First'.
Re^2: How to unpack numbers with varying sizes?
by Anonymous Monk on Feb 13, 2011 at 04:16 UTC
    'Q' should be 'Q>' if it's big endian.