in reply to Re: (Ovid) Re: Re: scalar subkeys %hash ?
in thread scalar subkeys %hash ?
I'd replace %tmp with @tmp, replace $counter with scalar(@tmp), replace $counter=0 with @tmp=(), and replace your last line with push @tmp, "$key -- $subkey";
I don't think your sample code works very well, but I'll assume that this is just a problem with the sample more so than the code you are really working with. But you shouldn't need the total number of subkeys in order to be able to handle those boundary cases. If you post some more accurate sample code that shows how you are trying to deal with the boundary case, we can probably help you figure that out.
- tye (but my friends call me "Tye")
|
|---|