in reply to Re: Re: Is this logic valid?
in thread Is this logic valid?

Your code iterates over the keys and values of the hash one at a time, putting the result into $key, a scalar variable. Then it looks in a hash named %key... I think that what you really want is:
foreach $currentkey (keys %hash) { }
(If you're cool with $_, you can leave out $currentkey in that incantation.) I can't figure out exactly what you want in the comparison, though. $hash{$currentkey} will give you the value associated with the key currently in consideration. To get the hash value for another value, you can use $hash{'key_name'} if you are referring directly to a string value for the key, or $hash{$value1} if the variable $value1 contains the name of that key.

Replies are listed 'Best First'.
Re: Re: Re: Re: Is this logic valid?
by wstarrs (Acolyte) on May 15, 2001 at 21:56 UTC
    Actually each key contains multiple values, so I think what I want is:
    foreach $currentkey (keys %hash) { if ($hash{$currentkey}{ValueNeeded} le $variable) { DO this.... }
    Does that clarify it any?