in reply to Debug and workaround help

Can you please explain what output you want?

My guess is that you want to replace <Buisnessnames ...> with <Bnames ...> in which case $' is incorrect.

You could consider using $&, but that IMHO is yet another idea.. Why don't you do one big replace? Why care about extracting the thing via a match and then using it in a subtitution?

What would be wrong with: s/<BusinessNames (.*?)>/$strRepl/mi; ?

Also note that you don't need the quotes in print "$string"; I would even suggest dropping them since it makes it a little bit less readable (or atleast to me)