my $string = '5mb of stuff'; my $count = $string =~ tr/\0/\0/;