Dru has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed Monks,

I am a big fan of this data structure, but I am ashamed to admit I am not even sure what it is called. I know it is some form of hash (obviously), but I have been pouring over the perldocs, especially perldsc, to try and finally figure out it's name, but I have finally admitted defeat. It appears to be a simple hash, but the key linking it to {$ip} is what is confusing me.

I would also like to know if it is possible to add a new key/value pair to the existing hash without having to create a new one, which is what I did to get the results I was after.

This is my existing data structure:
$hashIPs{$ip} = { totalVulns => $ipTotalVulns, vulns => $vulns };
and later in my code, I would like to add:
region => $region
I was able to accomplish what I wanted with the following, but for curiosity's sake, I would like to know if I could have avoided having to create the 2nd hash.
my $hashIPs{$ip} = { totalVulns => $ipTotalVulns, vulns => $vulns }; my $hashrefIPs = \%hashIPs; my $hashIPsNew{$ip} = { region => $region, totalVulns => ${$hashrefIPs}{$ip}{totalVulns}, vulns => ${$hashrefIPs}{$ip}{vulns} }; for my $ip (keys %hashIPsNew){ print "$ip -- $hashIPsNew{$ip}{region} -- $hashIPsNew{$ip}{totalVulns} + -- $hashIPsNew{$ip}{vulns}\n"; }

Perl, the Leatherman of Programming languages. - qazwart