perlquestion jedikaiti <p>I have this foreach loop that is supposed to grab some info and append it to a hash of a hash that already exists.</p> <p><c>foreach $cmd (keys %fssaCmd) { $opcode = sprintf("%x",$fssaCmd{$cmd}{fixed_pattern}); $apid = sprintf("%x",$ApidBase+$ApidOffset); print ("$cmd, 0x$apid, 0x$opcode\n"); %cmdData = (%cmdData, "0x$apid" => { opcode => "0x$opcode", cmd => $cmd } ) } foreach my $a (sort keys %cmdData) { print $a.", ".$cmdData{$a}{opcode}.", ".$cmdData{$a}{cmd}."\n"; }</c></p> <p>The second foreach loop is something I added to see if the first was working. It's not. The print statement in the first loop is working as expected, indicating that the loop is iterating a total of 6 times. However, the second loop is only printing out 2 lines: what was in the hash to begin with, and the last thing added to it by the first loop.</p> <p>What am I doing wrong here? Why is everything I append to the hash (except for the last thing) going AWOL? </p> <p>Many thanks!</p> <!-- Node text goes above. Div tags should contain sig only --> <div class="pmsig"><div class="pmsig-826783"> Kaiti<br /> Swiss Army Nerd </div></div>