in reply to Reducing HoH to AoA

dragonchild,
use Data::Dumper; my $aoa = []; for my $key ( keys %$start ) { push @$aoa , [ $key , keys %{ $start->{$key} } ]; } print Dumper($aoa);
Cheers - L~R

Oh - once you added code to your node, this doesn't make sense any more - see below

Replies are listed 'Best First'.
Re: Re: Reducing HoH to AoA
by dragonchild (Archbishop) on Apr 01, 2004 at 16:18 UTC
    That creates 4 copies of the set. I need one copy of the set. (Please see the code I updated my node with. That's what the delete is for.)

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

      dragonchild,
      Well after seeing your update, it helped to clear up the problem. You were not going into the second level hash for deletes. I still don't understand why the second example should end up in 1 slot instead of 2, but I think this is right:
      my $end = []; for my $key ( keys %$start ) { next if ! exists $start->{$key}; my @values = ($key , keys %{ $start->{$key} }); push @$end , \@values; Eradicate( @values ); } sub Eradicate { delete @{ $start }{ @_}; for my $key ( keys %$start ) { delete @{ $start->{$key} }{ @_ }; } } print Dumper( $end );
      Cheers - L~R