title: Read, delete some records and write the same XML file using Perl XML::Simple
body: <p>I have been struggling with this at work today. Trying to read in an XML file like the one below (that I have quickly just typed in). I have a CSV file of <code>show_id</code> codes. So I read them in and put them in a hash. Then I read in the XML file using <a href="https://metacpan.org/module/XML%3a%3aSimple" rel="nofollow"><code>XML::Simple</code></a>.</p>
  
  <p>I then compare the <code>show_id</code> code in the element (done a loop with an array as in the online examples and then <code>$a = $data-&gt;{Element1}-&gt;{Element2}-&gt;{show_id}</code> and that found it) below and see if I have a match on the hash table. Bingo. I got that to work with no problem.</p>
  
  <p>So let's say I match the middle two <code>Element2</code> elements with <code>show_id</code> values of <code>ABC11</code> and <code>ABC12</code>. Now I need to write a new file of the ones that do match. So I tried doing <code>XMLout</code> and I seem to lose the whole tag structure that I read in.</p>
  
  <p>Is there any way to read in the data below and get rid of the records <code>ABC10</code> and <code>ABC14</code> for instance, and wring out the file in the same format? Let me know if that makes sense. </p>
  
  <p>Also I only have <code>XML::Simple</code> and <code>XML::Parser</code> installed at work. Please HELP!!!</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  &lt;main&gt;
    &lt;Element1&gt;
      &lt;Element2&gt;
          &lt;show/&gt;
          &lt;show_id&gt;ABC10&lt;/show_id&gt;
          &lt;staring&gt;
              &lt;show_header&gt;This is a test&lt;/show_header&gt;
          &lt;/staring&gt;
      &lt;/Element2&gt;
          &lt;Element2&gt;
              &lt;show/&gt;
              &lt;show_id&gt;ABC11&lt;/show_id&gt;
              &lt;staring&gt;
                  &lt;show_header&gt;This is a test&lt;/show_header&gt;
              &lt;/staring&gt;
      &lt;/Element2&gt;
          &lt;Element2&gt;
              &lt;show/&gt;
              &lt;show_id&gt;ABC12&lt;/show_id&gt;
              &lt;staring&gt;
                  &lt;show_header&gt;This is a test&lt;/show_header&gt;
              &lt;/staring&gt;
      &lt;/Element2&gt;
          &lt;Element2&gt;
              &lt;show/&gt;
              &lt;show_id&gt;ABC14&lt;/show_id&gt;
              &lt;staring&gt;
                  &lt;show_header&gt;This is a test&lt;/show_header&gt;
              &lt;/staring&gt;
      &lt;/Element2&gt;
    &lt;/Element1&gt;
  &lt;/main&gt;
  </code></pre>