in reply to Writing a string of bits to a file, binary-style

You want pack, with the B for bitstring (MS bit first) and the count of * to use up all the characters in your string:
my $bits = '1010110101'; print OUTFILE pack('B*', $bits);