OK, I figured out how the record subroutine was blowing up inside the Twig module. It was the "next if" line that hung it.

if ( $class eq 'cmdb_ci_svr' ){ next if $seen{$app}{$ip}++; push @{$arx_data{$app}{'members'}},$ip; }
So I had to change it to this, seems I am ending up with CI's with members but no name. I am working to resolve that.
if ( $class eq 'cmdb_ci_appl'){ push @{$arx_data{$u_ci}{'name'}}, $name; } elsif ( $app ne "" && $ip ) { if ( exists $arx_data{$u_ci}{'name'} ) { push @{$arx_data{$app}{'members'}},$ip; } else { push @{$arx_data{$u_ci}{'name'}}, $null; push @{$arx_data{$app}{'members'}},$ip; } }

Now what I want to add is one of the sections that cleans up the data first. This validates the IP address and the name that should be its hostname from DNS records. Now I am trying to add this to your codebase which uses $ip instead of $data$ip_address_pos, but I was using the positional value to splice the corrected data. This is to create the CSV file with the corrected data, and I will also use it to fix ip addresses in the member arrays too. Any suggestion?

if ( $data[$ip_address_pos] eq "" && $data[$name_pos] ne "" && is_hostname($data[$name_pos])) { my $address = inet_aton($data[$name_pos]) || "Error: Can't resolve."; if ( $address ne "" && $address ne "Error: Can't resolve." ) { $address = inet_ntoa($address); splice @data, ($ip_address_pos), 1, $address; my $cmdb_name = $data[$name_pos]; my $cmdb_lc_name = lc $cmdb_name; splice @data, ($name_pos), 1, $cmdb_lc_name; } }

In reply to Re^6: Need help with complex hash of hashes. by vlturner
in thread Need help with complex hash of hashes. by vlturner

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.