title: Nesting hashes when lines have variable number of fields
body: <p>I have lines from Unix command, but each line has a variable number of fields.<br />
  I would like to create nested hashes. How can I accomplish that?</p>
  <p>I am splitting each line using <code>split ('[\|=]' $line)</code></p>
  <p>Data from command:</p>
  <pre><code>node:server1|name=server1
  node:server1|status=up
  node:server1|state=running
  node:server1|initial_incarnation=1
  node:server1|os_status=up
  node:server1|summary=ok
  
  
  
  node:server2|subnet:X.Y.Z.0|name=X.Y.Z.0
  node:server2|subnet:X.Y.Z.0|route_id=1
  node:server2|subnet:X.Y.Z.0|status=up
  node:server2|subnet:X.Y.Z.0|ip_monitor=off
  
  node:server1|interface:lan1|ip_address:X.Y.Z.17|name=X.Y.Z.17
  node:server1|interface:lan1|ip_address:X.Y.Z.17|netmask=255.255.248.0
  node:server1|interface:lan1|ip_address:X.Y.Z.17|subnet=X.Y.Z.0
  node:server1|interface:lan1|ip_address:X.Y.Z.17|route_id=1
  node:server1|interface:lan1|ip_address:X.Y.Z.17|heartbeat=true
  
  node:server1|interface:lan2|ip_address:X.Y.Z.17|name=X.Y.Z.17
  node:server1|interface:lan2|ip_address:X.Y.Z.17|netmask=255.255.248.0
  node:server1|interface:lan2|ip_address:X.Y.Z.17|subnet=X.Y.Z.0
  node:server1|interface:lan2|ip_address:X.Y.Z.17|route_id=1
  node:server1|interface:lan2|ip_address:X.Y.Z.17|heartbeat=true
  </code></pre>
  <p>I would like to accomplish HOH as below:</p>
  <pre><code>%hoh = (
      'node:server1' =&gt; {
          name   =&gt; 'server1',
          status =&gt; 'up',
          ...,
          summary          =&gt; 'ok',
          'interface:lan1' =&gt; {
              'ip_address:X.Y.Z.17' =&gt; {
                  name    =&gt; 'X.Y.Z.17',
                  netmask =&gt; '255.255.248.0',
              },
              ...,
          },
          'nterface:lan2' =&gt; {
              'ip_address:X.Y.Z.18' =&gt; {
                  name    =&gt; 'X.Y.Z.18',
                  netmask =&gt; '255.255.248.0',
              },
              ...,
          },
      },
      'node:server2' =&gt; ...,
  );
    
  </code></pre>