http://qs321.pair.com?node_id=641667

pysome has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,
I wanna to replace these "TXT" ONLY locate out of TAGS to "FOO", How to compose the regex??
my $str = '<a code=TXT> abc TXT </a> <text code=TXT> efg TXT </text> < +input s=TXT> hig TXT</input>';
After substitution,I want to get $str is :
<a code=TXT> abc FOO </a> <text code=TXT> efg FOO </text> <input s=TXT +> hig FOO</input>
Thanks in advance.
update:NO while loop