How can I remove all spaces between two XML tags?
<p>I have a Perl script that I want to amend to remove spaces between two XML tags.</p>

<p>Example XML:</p>

<pre><code>&lt;TAG&gt;
&lt;TAG1&gt;&lt;TAG2&gt;abc 123 def 456 ... &lt;/TAG2&gt;&lt;/TAG1&gt;&lt;TAG1&gt;&lt;TAG2&gt;xyz 987 ... &lt;/TAG&gt;
</code></pre>

<p>I'd like to remove all occurrences of spaces between all <code>TAG2</code> tags. I tried the following:</p>

<pre><code>$vModStrg =~ s/(&lt;TAG2&gt;(.*?)&lt;\/TAG2&gt;)/&lt;TAG2&gt;zzzzzz&lt;\/TAG2&gt;/g;
</code></pre>

<p>but this replaces the whole match with <code>zzzzz</code>. How can I tell Perl to only remove the spaces from the match for all the occurrences of <code>TAG2</code>?</p>