in reply to Counting the number of replaces
Note too that the $_ =~ is redundant. The regex on its own is quite sufficient: my $count = s/<I>/<italic>/g;.