in reply to RE: Re: Multiple identical keys in a hash.
in thread Multiple identical keys in a hash.

You could put all the values in array references indexed by your two-level hash. Something like this:
foreach $f (@files) { open FILE, $f or die "Error: $!"; while(<FILE>) { chomp; my ($k,$v)=split("=",$_,2); # Assume dn= comes before other lines $level1=$k, next if $k eq "dn"; unless ($level1) { die "Need to get dn= line first\n"; } push @{$hash{$level1}{$k}}, $v; } close FILE; }
Then you will have something like this:
$hash{machinename}{config}=["2000"] $hash{machinename}{speed}=["19200"] $hash{machinename}{setting}=["value1", "value2", "value3"] $hash{machinename2}{config}=["2020"] etc.
And then do comparisons or anything else you need. See chapter 4 of The Perl Cookbook for examples of how to do fancy array operations, including comparisons.