Hello BaldGorilla, and welcome to the Monastery!
I assume the line print $new_gpd_fh "$line"; is meant to be print $new_fh "$line";? With this change made, I cannot reproduce your problem.
Specifically, I created a text file, then used a hex editor to insert a null (\x00) at a suitable place in the text, and ran the script. The resulting new file has a null character in the correct place, as expected. (Confirmed both in the hex editor and in Notepad++, which displays a NUL control character.)
Are you sure that your new file contains a space character in place of the null? Or could the space you are seeing be an artefact of the way you are viewing the file contents?
Cheers,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Null \x00 being replaced by space \x20
by Athanasius
in thread Null \x00 being replaced by space \x20
by BaldGorilla
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |