## simple array problem

Expand Messages
• Hello I have a pretty simple problem ex: @a=qw( 1 2 3 4 5 6 7 ); \$b=5; now i just want to check if the value of \$b i.e 5 exists in the array @a or not Q 1) is
Message 1 of 3 , Oct 7, 2005
Hello
I have a pretty simple problem

ex:
@a=qw( 1 2 3 4 5 6 7 );
\$b=5;

now i just want to check if the value of \$b i.e 5
exists in the array @a or not

Q 1) is there any way other than looping through the
array?

Q2 ) is there any predefined function to check the
existance of the element in the array..

jabir ahmed

--
It matters not whether you win or lose; what matters is whether I win or
lose.
Phone: +91 98867 01148
email: jabirahmed@... , jabirahmed@...
Instant Messenger:
yahoo jabirahmed@...,msn : jabir07@...,ICQ: 56327312, Skype:
jabirahmed

[Non-text portions of this message have been removed]
• Hi, Q 1) is there any way other than looping through the array? No.There is no way for this. Better way you can put all element into hash and you can check
Message 2 of 3 , Oct 8, 2005
Hi,
Q 1) is there any way other than looping through the
array?

No.There is no way for this. Better way you can put all element into hash and you can check existance of element using

exists(\$hash{key}) function of hash.

Keep key and value both same i.e. 5-5,6-6 etc

Q2 ) is there any predefined function to check the
existance of the element in the array..

NO. There is no such function.

Regards,
Prasanna Goupal

---------------------------------
Yahoo! Music Unlimited - Access over 1 million songs. Try it free.

[Non-text portions of this message have been removed]
• ... jabir now i just want to check if the value of \$b i.e 5 jabir exists in the array @a or not This is asked frequently enough that it s (amazingly enough)
Message 3 of 3 , Oct 8, 2005
>>>>> "jabir" == jabir ahmed <jabirahmed@...> writes:

jabir> now i just want to check if the value of \$b i.e 5
jabir> exists in the array @a or not

This is asked frequently enough that it's (amazingly enough)