banduwgs has asked for the wisdom of the Perl Monks concerning the following question:
But my question is what is the optimal way to implement the functionality of "in" at "### in the above code (without looping entire array.use strict; my %hash = ( 'key01' => '1', 'key02' => '2', 'key03' => '3', ); my $key = 'key01'; if ($key in keys(%hash)) { ### print "$key is in hash"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Best way check key availability
by liz (Monsignor) on Sep 11, 2003 at 16:35 UTC | |
by Anonymous Monk on Sep 11, 2003 at 17:09 UTC | |
by liz (Monsignor) on Sep 11, 2003 at 17:19 UTC | |
by hardburn (Abbot) on Sep 11, 2003 at 21:00 UTC | |
|
Re: Best way check key availability
by naChoZ (Curate) on Sep 11, 2003 at 16:36 UTC | |
by davido (Cardinal) on Sep 11, 2003 at 17:24 UTC |