in reply to Accessing deeply burried arrays of hashes

The problem seems to be that you're treating your anonymous array as a hash in this bit of code:

foreach $subsubkey (sort %{$tophash{$value}{$value2}} ) { print "$subsubkey"; }

It's an array, so treat it as one. This should get you started:

foreach $array_value ( @$tophash{$value}{$value2} ) { print $array_value; }

Notice you don't *need* the extra set of braces (but leave 'em in if they make things clearer to you.

Update This last sentence is false, as merlyn notes in his response. So see that one =)

Philosophy can be made out of anything. Or less -- Jerry A. Fodor

Replies are listed 'Best First'.
Re: Re: Accessing deeply burried arrays of hashes
by merlyn (Sage) on Jan 25, 2001 at 04:05 UTC
    @$tophash{$value}{$value2}
    Uh, you're missing a curly set:
    @{$tophash{$value}{$value2}}
    Without that, it parses like:
    $tophash must be a hashref, so deref it as a slice with $value being the (only) key, then take that slice (ugh) and deref it (them?) as a hashref with $value2 for the key.
    Definitely perverted. Almost certainly wrong.

    -- Randal L. Schwartz, Perl hacker