Some of your code from above would change from:
would become$NetNameAndFanout = join (" ",$NetName,$NetFanout); $NetStatsHash{$NetNameAndFanout} = join (" ",$NetCap,$NetRes,$NetLengt +h,$FirstDriver);
$NetStatsHash{$NetName}{$NetFanout}{Cap} = $NetCap; $NetStatsHash{$NetName}{$NetFanout}{Length} = $NetLength; $NetStatsHash{$NetName}{$NetFanout}{Driver} = $FirstDriver;
In that way, instead of
you'd sayforeach $KeyNetName (keys %NetStatsHash) { @KeyEntries = split (/\s+/,$MasterKey); $KeyNetName = $KeyEntries[0]; $KeyFanout = $KeyEntries[1]; $OkayToAdd = 0; if ($KeyFanout == $i) { @NetDetails = split (/\s+/,$NetStatsHash{$MasterKey}); $NetCap = $NetDetails[0]; $NetRes = $NetDetails[1]; ### etc.
This is untested, but the principle is there... Good luck, and post if there are any problems or further questions.foreach $KeyNetName (keys %NetStatsHash) { foreach $KeyFanOut ( keys %{ $NetStatsHash{$KeyNetName} } ) { $OkayToAdd = 0; if ($KeyFanout == $i) { $NetCap = $NetStatsHash{$KeyNetName}{$KeyFanOut}{Cap}; $NetRes = $NetStatsHash{$KeyNetName}{$KeyFanOut}{Length}; ### etc. }
In reply to Re: Managing multi-key hash tables....
by apl
in thread Managing multi-key hash tables....
by fiddler42
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |