in reply to Extracting data from nested hashes
To print out a table, use another nested loop:my %table; # The number of items of group $d of length N (where N is 1 to a # max. length determined elsewhere) found in $b. for my $file (keys %a) { for my $group (keys %{$a{$file}}) { for my $subgroup (keys %{$a{$file}{$group}}) { for my $length (@{$a{$file}{$group}{$subgroup}}) { $table{$file}{$subgroup}[$length]++; } } } }
Update: fixed a typo in the second comment.my $file = 'xxx'; for my $length (1..$max_length) { for my $unique_d (keys %{$a{$file}{$group}}) { # printing stuff using $table{$file}{$unique_d}[$length] } }
-Mark
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extracting data from nested hashes
by knirirr (Scribe) on Nov 17, 2004 at 17:38 UTC |