How to have incremented variable in global substitution?

Viewed 131
$html =~ s[<p>(.+?)</p>][<li value="++$count">$1</li>]gis;

How can I achieve the above code in perl?

I need the ++$count to be a number that increments for every substitution that takes place.

2 Answers
Related