How to check if there is an existing entry in array of the hash in perl..please, please

C

Cyrus

Hi folks,
I'm new in this group, I would like to ask all of the Perl experts out
there, if any one knows how to prevent a duplicated entry in array of
the hash: here is what I need to do. The script periodically check for
disk status if there is an error it adds it to array of the hash with
keys & value, what I need is before it push/append it to the array of
the hash it check to see if the key & value exists if not then
push/append it else do other stuff or next
Thanks in advance & hop I can get an answer from one of you guys..
Cheers

Here is a portion of the code:
my $sh = $c->show_disk();
foreach my $sys (@sys_arry) {
foreach my $el (@$sh) {
if ($el->{'status'} ne "OK")
{
# Here I know I should check to see if the keys & value exits
but don't know how!!
push @DiskErr, {sys=>$sys, disk=>$el->{'id'},
status=>$el->{'status'}};
} else
{
print "$sys: Status OK\n";
}
}
}
 
C

Cyrus

Mirco said:
Thus spoke Cyrus (on 2006-12-20 20:37):


Which "key and value". There are *three* of
them each. Do they depend on each other?
Or are they orthogonal?

Regards

Mirco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top