I'm just curious as to why you're using the many if statements.
I suppose the following should work:
Note the use of the 'g' modifier.$data=~ s{<rstate>[^<\n]+</rstate>}{<rstate>$new_text</rstate>}g
In reply to Re^3: regex: Need help substituting
by Joe_
in thread regex: Need help substituting
by the_perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |