title: how to print the output in certain order?
body: <p>I am trying to extracting the data from an XML document and print it in a certain order, but I'm unable to print in that order</p>
  
  <p><strong>Input XML</strong></p>
  
  <pre><code>&lt;xml&gt;
    &lt;service&gt;
      &lt;title&gt;split xml&lt;/title&gt;
      &lt;main&gt;
        &lt;doc id="001"&gt;
          &lt;title&gt;doc1&lt;/title&gt;
          &lt;delt id="0001"&gt;
            &lt;title&gt;delt1&lt;/title&gt;
            &lt;text&gt;num1&lt;/text&gt;
          &lt;/delt&gt;
          &lt;delt id="0002-A"&gt;
            &lt;title&gt;delt2&lt;/title&gt;
            &lt;text&gt;num1&lt;/text&gt;
          &lt;/delt&gt;
        &lt;/doc&gt;
        &lt;doc id="002"&gt;
          &lt;title&gt;doc2&lt;/title&gt;
          &lt;delt id="0003"&gt;
            &lt;title&gt;delt3&lt;/title&gt;
            &lt;text&gt;num1&lt;/text&gt;
          &lt;/delt&gt;
          &lt;delt id="0004"&gt;
            &lt;title&gt;delt4&lt;/title&gt;
            &lt;text&gt;num1&lt;/text&gt;
          &lt;/delt&gt;
        &lt;/doc&gt;
      &lt;/main&gt;
    &lt;/service&gt;
  &lt;/xml&gt;
  </code></pre>
  
  <p><strong>output printing in this order</strong></p>
  
  <pre><code>0001
  delt1
  0002-A
  delt2
  0003
  delt3
  0004
  delt4
  </code></pre>
  
  <p><strong>output needed</strong></p>
  
  <pre><code>delt1   0001    
  delt2   0002-A
  delt3   0003    
  delt4   0004
  </code></pre>
  
  <p><strong>This is my code</strong>    </p>
  
  <pre><code>use File::Find;
  use XML::LibXML;
  use Data::Dumper;
  
  my $path = "data.xml";
  my $parser = XML::LibXML-&gt;new;
  my $dom = $parser-&gt;parse_file($path) or die;
  
  for my $sample ( $dom-&gt;findnodes('//delt/@id|//delt/title') ) {
    print $sample-&gt;textContent(),"\t";  
    print "\n";
  }
  </code></pre>