# my $bytes = read ... my $bitstring = unpack 'B*', $bytes; $bitstring = sprintf '%.64d', $bitstring; my $num = unpack 'Q', pack 'B*', $bitstring;