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


in reply to Search and replace query

You need to search for <bindname>abcde<\/bindname>, and if it appears in the current line, store that information in a variable.

then if you do the substitution, check first if that variable is set.

And to remember to reset that variable in an appropriate place