I think you just want =~ /\0/
This script will strip out Nulls from a test file.
#!/usr/bin/perl
use warnings;
open(IH,"<null-bytes-test-in") or die $!;
@in = (<IH>);
close IH;
open(OH,"+>null-bytes-test-out");
foreach $line (@in){
$line =~ s/\0//g;
print OH $line;
}
close OH;