$out = "output_path"; open (OUTBIN, '>',"$out") || die "unable to open $out"; binmode(OUTBIN) || die "unable to set binmode $out";