The match operator (/foo/) only returns a boolean to indicate that it did or did not match. Our friend Mr. Substitution gives us more data. tr/// is probably much faster for simple substrings, not regex's.
In reply to Try the Substitution Operator
by chromatic
in thread Counting Substrings in Strings
by CmdrTaco
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |