OH. I see. No, i misspoke slightly - the output I get is exactly the same as yours, except mine doesn't generate the last line you are not wanting. Here is what I get, on Solaris 8, with Perl 5.8, using the code as I posted it:
$i = 0, $j = 0, $foo->[0][0]->{name} = Dan, $foo->[0][0]->{id} =...