The simplest, fastest and most efficient way to count the nulls (or any character) in a string is:
my $nulls = $string =~ tr[\0][\0];
Update: corrected '0' to '\0'. Thanks to davido.
In reply to Re^3: Out of Memory
by BrowserUk
in thread Out of Memory
by Michael Kittrell
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |