http://www.perlmonks.org?node_id=557537


in reply to Counting the number of replaces

Try this. $a = $b=~s/<i>/<italic>/g; print "$a"; Gives the output you need.