That's waaaaaaay over my head.  The method I used works so I'll stick with that.
 Thanks though.  :)

Keep up with me and what I'm up to: http://theillien.blogspot.com


Chas Owens wrote:
> My understanding of the problem:
> 
> You have a ref to a HoH and you need to find all of the first set of
> keys that have a specific, but unspecified at coding time, second key
> or value.
> 
> For key I would do something like this
> 
> my $key2 = func_to_get_key2();
> for $key1 (grep { exists $store->{$key1}{$key2} } sort keys %$store) {
>    process($store, $key1, $key2);
> }
> 
> For value I would use a similar construct
> 
> my ($key2, $value) = func_to_get_key2_and_value();
> for $key1 (grep { $store->{$key1}{$key2} eq $value } sort keys %$store) {
>    process($store, $key1, $key2);
> }
> 
> N.B. eq is not a good test of equality for numbers (use == instead)
> and == is not a good test of equality for floating point numbers that
> are the result of even simple operations (use an inequaltiy with an
> appropriate delta* instead); hopefully objects will provide an
> overridden eq or == operator or will provide an explicit method for
> testing equality.
> 
> 
> * I may have butchered that, what I mean is something like
> ($value <= $target-$delta and $value <= $target+$delta)
> where $delta is a small value that is equal to the amount of rounding
> error you think may have crept in.
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to