On Thu, 25 Jul 2002, Sudarshan Raghavan wrote:

> On Thu, 25 Jul 2002, Daniel David wrote:
> 
> > Hi,
> > I couldn't seem to find a built-in function for finding the index
> > of an element in an array...so I wrote this one:
> > 
> > --------------------------------------------------------------------
> > 
> > #  position_of returns the position of a string in an array of strings,
> > #  and -1 if the string is not a member of the array.
> 
> For an 'is it present' kind of operation a hash might be a better option. 
> You will have explain as to what you need this for to decide that? Store 
> your values as hash keys and a simple if (defined $hash{$value}) would do.

Sorry, that should be if (exists $hash{$value}) 


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

Reply via email to