When you bind a variable to a substitution, the expression as a whole will return the number of substitutions made, e.g. ,
$replacements =$myvar =~s/foo/bar/g;
$replacements will give you the total count of replacements.
Tuesday, September 18, 2007
Regex - Replacement Count
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment