in reply to Re^2: hash of hash - incorrect values?
in thread hash of hash - incorrect values?
You misunderstand $hash{a}{b}. Hashes only have one level. $hash{a}{b} is a hash of a hash. $hash{a}{b} is a shortcut for ${$hash{a}}{b}. That means "the value at key 'b' in the hash referenced by $hash{a}." $hash{a} can't contain both a hash reference and a number, so $hash{a}++ and $hash{a}{b} conflict.
There is an easy solution. Replace
$Stats{$DestPort}++; $Stats{$DestPort}{covert}{"..."}++;
with
$Stats{$DestPort}{total}++; $Stats{$DestPort}{covert}{"..."}++;
or
$Stats{$DestPort}{total}++; $Stats{$DestPort}{item}{covert}{"..."}++;
|
|---|