Re: how to test if an element belongs to an array or hash
- From: Brian Wakem <no@xxxxxxxxx>
- Date: Tue, 31 May 2005 21:32:35 +0100
biomahui@xxxxxxxxx wrote:
>
> A new question related:
>
> if I created a hash, $set{$a}{$b}=1, I can get the keys of $b for a
> given $a, using "keys %{$set{$a}}";
>
> My question is, Is there any function that can test the existence of an
> element belongs to $b for a given $a?
> Thanks!
I think you mean this:-
if (exists $set{'fruit'}{'pear'}) {
print "Pear is a fruit\n";
}
else {
print "Pear in not a fruit\n";
}
If not, please clarify.
--
Brian Wakem
.
- Follow-Ups:
- Re: how to test if an element belongs to an array or hash
- From: biomahui
- Re: how to test if an element belongs to an array or hash
- References:
- how to test if an element belongs to an array or hash
- From: biomahui
- Re: how to test if an element belongs to an array or hash
- From: John Bokma
- Re: how to test if an element belongs to an array or hash
- From: biomahui
- Re: how to test if an element belongs to an array or hash
- From: Brian Wakem
- Re: how to test if an element belongs to an array or hash
- From: biomahui
- Re: how to test if an element belongs to an array or hash
- From: biomahui
- how to test if an element belongs to an array or hash
- Prev by Date: Re: how to test if an element belongs to an array or hash
- Next by Date: Re: Net::Server::PreforkSimple and External Commands
- Previous by thread: Re: how to test if an element belongs to an array or hash
- Next by thread: Re: how to test if an element belongs to an array or hash
- Index(es):
Relevant Pages
|