i am sorry. I really meant asso array .. On Thu, Mar 20, 2008 at 8:32 PM, Chas. Owens <[EMAIL PROTECTED]> wrote: > > On Thu, Mar 20, 2008 at 10:50 AM, Sharan Basappa > <[EMAIL PROTECTED]> wrote: > > Is there a way to find out if an entry exists in a hash array? > > e.g. I have a hash array and another normal array. I would like loop > > though regular array and see if the entries defined in this array exist > > in hash array. > snip > > By hash array do you mean an array of hashes (AoH), a hash of arrays > (HoA), or are you merging the names hash and associative array (the > real name of hashes)? By your question I think you mean the last > item. You can loop through the array using for and test for the > existence of a key with exists: > > for my $element (@array) { > if (exists $hash{$element}) { > print "$element is in the hash\n"; > } > } > > -- > Chas. Owens > wonkden.net > The most important skill a programmer can have is the ability to read. >
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/