in reply to Re^2: Out of Memory
in thread Out of Memory
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Out of Memory
by Michael Kittrell (Novice) on Mar 28, 2013 at 19:05 UTC | |
by BrowserUk (Patriarch) on Mar 28, 2013 at 19:12 UTC | |
by Michael Kittrell (Novice) on Mar 28, 2013 at 19:31 UTC | |
by BrowserUk (Patriarch) on Mar 28, 2013 at 19:55 UTC | |
by Michael Kittrell (Novice) on Mar 28, 2013 at 22:33 UTC |