Instead of a non-greedy qualifier, you can use a negative look-behind assertion to get your replacement right. (See perlre)
$xml =~ s#\t<element attribute='$name'>(?:.(?<!</element>))*</element> +\n#$node#s;
Side note: the /s modifier is not needed here.
In reply to Re: limiting regular expression greediness?
by Caron
in thread limiting regular expression greediness?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |