in reply to Re: Reducing HoH to AoA
in thread Reducing HoH to AoA

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

Replies are listed 'Best First'.
Re: Re: Re: Reducing HoH to AoA
by Limbic~Region (Chancellor) on Apr 01, 2004 at 16:38 UTC
    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