It's much quicker to avoid the eval by xoring with a string of 'z's and then counting the nulls:
my $ans = ( $str ^ ( $SrchStr x length $str ) ) =~ tr[\0][\0];
In reply to Re:Capturing occurrence counts via tr/// with variable interpolation
by BrowserUk
in thread Capturing occurrence counts via tr/// with variable interpolation
by KenW
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |