open(BINARYFILE, ">file") or die "can't open file for writing: $!"; binmode(BINARYFILE);