"Igor Sutton" schreef:
> [attribution repaired] Mumia W:
>> Yes there is a faster way. Use the "reverse" function:
>>
>> my %hash = (dog => 'house', pig => 'barn', bird=> 'cage');
>> my %rhash = reverse %hash;
>> if ($rhash{house}) {
>> print "Found house.\n";
>> }
>
> That's a really good looking idiom, but I see it is less efficient
> than the foreach method.
The reverse only has to be done once, so it already pays off if you need
to make 2 or more comparisons.
The problem with duplicates remains though. See also `perldoc -q
look.*hash.*value`.
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/