|
|
| laziness, impatience, and hubris | |
| PerlMonks |
Re: Parsing text file into a hash with multiple values per keyby Anonymous Monk |
| on Oct 03, 2012 at 22:40 UTC ( #997142=note: print w/ replies, xml ) | Need Help?? |
|
how do I remove duplicates (Host and VM)? There are no duplicate hosts (hash takes care of that), so to get rid of duplicate VM, use another hash, a hash of hashes, ie $HostVM{$host}{$VM}++ how do I then count the # of values per key? For your existing code my $count = @{ $hash{ $host } }; For my code my $count = keys %{ $hash{$host}{$vms} };
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||