This is the first time I've done this, so I hope I'm doing it properly. This should be fairly simple for anyone fairly experienced. Thanks in advance. :)
# I have a hash of usernames %postiniList. # I have another hash of usernames %ldapList. # I have a text file in the working dir called # users.txt which contains one line per email # address with other unnecessary crap also. # We are traversing %postiniList to see if each key exists # in %ldapList and take action if it does NOT. foreach (keys %postiniList) { + + if(exists $ldapList{$_}) { print "$_ exists in ldap\n"; next; } else { print "$_ does not exist in ldap\n"; my $emailString = `cat users.txt |grep $_`; # these next three lines are messing it all up! if($emailString =~ /(\w+\@\w+\.\w+)/) { print "deleteuser $1\n"; } } }
janitored by ybiC: Moved introductory text out of <code> tags.
In reply to hash comparison & nested selections by silentc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |