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

Your sig has nearly all the answer:

print OUTFILE, pack("B*",$string);

After Compline,
Zaxo

update: Idiotic blunder repaired