in reply to (Ovid) Re: Re: scalar subkeys %hash ?
in thread scalar subkeys %hash ?
The reason I'm trying to get at a scalar value for the subkeys
in a %HashOfHashes without looping is because I'm already
iterating through the keys/subkeys.
What I'm really trying to do: given a %HoH, iterate through
the subkeys and display each $interval group of subkeys
(where $interval is a positive integer). Of course, when
I get to the end, I'll need to kick out the last group even
though the counter never gets to $interval.
Example and pseudocode: my %HoH contains 97 subkey-value pairs
(but I don't it's 97).
The problem I run into is when $counter is a remainderless$interval = 10; foreach $key (keys %HoH) { if ($interval % $counter == 0) { display(\%tmp); $counter = 0; # reset the counter } foreach $subkey (keys %{$HoH{$key}}) { $tmp{++$counter} = "$key -- $subkey"; } }
Muchas gracias,
"dogs luv me cuz i'm crazy sniffable / i bet you never knew i got the ill peripherals"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: scalar subkeys %hash ?
by tye (Sage) on Jun 14, 2001 at 10:54 UTC | |
|
Re: Re: Re: scalar subkeys %hash ?
by crazysniffable (Acolyte) on Jun 15, 2001 at 02:49 UTC |