An alternative to tranliterating to delete the \0 characters and then getting the length of what's left would be to complement the \0's, assigning to a scalar so as to count all non-nulls.
my $count = $x =~ tr/\0//c; print "'$s' at offset $i matched" unless $count > 1;
It's six of one, a half-dozen of the other I suppose but I thought it might be worth a mention.
Cheers,
JohnGG
In reply to Re^2: generating hash patterns for searching with one mismatch
by johngg
in thread generating hash patterns for searching with one mismatch
by cedance
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |