> -----Original Message-----
> From: Andre` Niel Cameron [mailto:[EMAIL PROTECTED]]
> Sent: Friday, November 30, 2001 2:07 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Program dilema
> 
> 
> Hi,
> 
> I am having a bit of a problem.  Does anyone have any idea 
> how I could have
> a variable and see if the value of that variable is also 
> located in an array
> and hash?  IE:
> 
> $myvar= 6
> 
> @myarray= ("4", "7", 10", 6")
> 
> if (6 exists in @myarray) (
> dothis}
> else{
> dothis}

Your example is for an array. There's a nice FAQ on this:

perldoc -q 'How can I tell whether a list or array contains a certain
element?'

For a hash, use the exists() function:

perldoc -f exists

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to