That is how I do it also - compare an array against a hash (my base line of
known items)....

foreach $users (@users) {                # Loops through array of user IDs
from server (the array is my list in question)
     $users =~ tr/[A-Z]/[a-z]/ ;              # Converts each to all lower
case
     if (! exists $actions{$users}) {         # Compare each to hash to see
if they exist in hash (the hash is my "known good list")
          push(@badusers, $users); # If not in authorized hash, pushes to
baduser array
     }
}

Glenn Meyer   -  [EMAIL PROTECTED]
IBM Global Service
Content Hosting Systems Administrator




                                                                                       
                                                
                    Lomker Michael <[EMAIL PROTECTED]>                                   
                                                
                    Sent by:                                    To:     "Satelle, 
StevenX" <[EMAIL PROTECTED]>                 
                    [EMAIL PROTECTED]       cc:     
[EMAIL PROTECTED]                      
                    eState.com                                  Subject:     Re: 
Comparing an array to an array                        
                                                                                       
                                                
                                                                                       
                                                
                    01/27/2002 10:56 AM                                                
                                                
                                                                                       
                                                
                                                                                       
                                                



> Does anyone know how to do this? I dont mean the amount of variables in
> it.
> I mean take list "a" and compare each element  to each element of list
> "b"
> and if they match do something.

There is undoubtedly a way to use the CMP operator on a pair of arrays,
but I found it  easier to convert one of the arrays to a hash and check
for the existence of the key.

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin



_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to