Hi,

Suppose I have a hash:

my %hash = (dog => 'house', pig => 'barn', bird=> 'cage');

Now I want to know if there is already a key with a 'house' value as I do not 
want to create another key with the same value.
Is there any other faster way to do it than doing a

for (keys %hash){
if ($hash{$_} eq 'house'){
  #found 'house'! 
}


What if I got thousands of keys?

Lastly, how fast is the "if (exists $hash{$key})"? Is it faster than doing a 
'for keys' loop, and testing if a given $_ key will appear?


Thanks.



 
____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/

Reply via email to