Re: if exists with array

2003-02-12 Thread Janek Schleicher
On Tue, 11 Feb 2003 17:31:42 +, Felix Geerinckx wrote: > on di, 11 feb 2003 17:22:20 GMT, Dan Muey wrote: > >> if(exists $hash{$key}) { ... } >> >> is there a way to do that with arrays? >> IE >> if there is an array element that is 'bob' then do this :: >> without having to do a foreach on

RE: if exists with array

2003-02-11 Thread Kipp, James
> > Unless the arrays become too big, > > grep is your friend > > (perldoc -f grep) > > According to the FAQ I mentioned in another reply, it isn't ;-) yep, i spoke to soon as well. grep has always worked well for me. so there is the quick and dirty way, then the right way :) from the faq: Ple

RE: if exists with array

2003-02-11 Thread Kipp, James
> if(exists $hash{$key}) { ... } > > is there a way to do that with arrays? > IE > if there is an array element that is 'bob' then do this :: > without having to do a foreach on the array > > basically an easier/better/faster/ way to do this : > > @search_for_these = > @search_me =

Re: if exists with array

2003-02-11 Thread Felix Geerinckx
on di, 11 feb 2003 15:54:36 GMT, Janek Schleicher wrote: > On Tue, 11 Feb 2003 11:22:20 -0600, Dan Muey wrote: > >> is there a way to do that with arrays? >> IE >> if there is an array element that is 'bob' then do this :: >> without having to do a foreach on the array > > Unless the arrays beco

Re: if exists with array

2003-02-11 Thread Felix Geerinckx
on di, 11 feb 2003 17:22:20 GMT, Dan Muey wrote: > if(exists $hash{$key}) { ... } > > is there a way to do that with arrays? > IE > if there is an array element that is 'bob' then do this :: > without having to do a foreach on the array See perldoc -q "array contains" in the Frequently

Re: if exists with array

2003-02-11 Thread Janek Schleicher
On Tue, 11 Feb 2003 11:22:20 -0600, Dan Muey wrote: > is there a way to do that with arrays? > IE > if there is an array element that is 'bob' then do this :: > without having to do a foreach on the array Unless the arrays become too big, grep is your friend (perldoc -f grep) If they become too

if exists with array

2003-02-11 Thread Dan Muey
Withh a hash you can do if(exists $hash{$key}) { ... } is there a way to do that with arrays? IE if there is an array element that is 'bob' then do this :: without having to do a foreach on the array basically an easier/better/faster/ way to do this : @search_for_these = @search_me =