Re: how to test if an element belongs to an array or hash
- From: "Jim Keenan" <jkeen_via_google@xxxxxxxxx>
- Date: 31 May 2005 10:41:08 -0700
biomahui@xxxxxxxxx wrote:
> Thanks.
>
> Another question,
> Is there a way to find the keyvals from their values without using
> iteration. For instance;
>
> $set{"apple"}="fruit";$set{"pear"}="fruit";$set{"banana"}="fruit";$set{"beef"}="meal";
>
> I need to find "apple","pear" etc from "fruit".
my @fruit;
for (keys %set) {push(@fruit, $_) if $set{$_} eq 'fruit'; }
Jim Keenan
.
- Follow-Ups:
- 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
- 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
- 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: how to test if an element belongs to an array or hash
- 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
|
|