Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Part 2: How to prevent duplicated entry in array of the hash ...please

Reply
Thread Tools

Part 2: How to prevent duplicated entry in array of the hash ...please

 
 
Cyrus
Guest
Posts: n/a
 
      12-20-2006

One more thing to add is a system has multiple disks, & I have more
than 200 systems to check for system, disk & disk status. to make it
more clear if script finds an error say on system-X with disk 2 &
status No-In-Service it notify user and go to the next system, when it
hits same system again it checks to see if this is a same system if so
if this is a same disk if this is same system & same disk & same status
then don't notify user simply go to the next till the status of the
disk gets change when it hits that system again!


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....I need to check for all
keys & value
Thanks in advance & hop I can get an answer from one of you guys..
Cheers

Here is a portion of the code:
While (<>) {
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";
}
}
}
}

 
Reply With Quote
 
 
 
 
A. Sinan Unur
Guest
Posts: n/a
 
      12-20-2006
"Cyrus" <(E-Mail Removed)> wrote in
news:(E-Mail Removed) ups.com:

> I'm new in this group,


Then you should read the posting guidelines. They contain valuable
information on how to maximize your chances of getting useful responses.

Also, don't keep starting new threads. Keep messages on the same topic
within the same thread.

> Thanks in advance


You are welcome in advance.

Sinan
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
hash of hash of hash of hash in c++ rp C++ 1 11-10-2011 04:45 PM
How to prevent duplicated entry in array of the hash Cyrus Perl Misc 19 12-22-2006 09:34 PM
How to prevent duplicated entry in array of the hash Cyrus Perl Misc 1 12-20-2006 11:47 PM
Form entry to Time part of database Date entry? Noozer Javascript 2 08-01-2005 08:10 PM



Advertisments