in reply to Parsing text file into a hash with multiple values per key
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} };
Tutorials► Data Types and Variables
|
---|
In Section
Seekers of Perl Wisdom