Hi, I'm trying to find out which users in a passwd file are not in a
database. What I've tried so far(see below) finds a few but misses even
more. I'm thinking it might be the way I'm preparing the statement or
perhaps executing it? Something else all together? Any help appreciated.
<snip>
$sql = $dbh->prepare_cached("SELECT CustNo, UserName FROM call_log WHERE
UserName = ?");
open(IN, "passwd") || die "Can't open passwd file:$!\n";
open(OUT, ">usernames.db") || die "Can't create output file:$!\n";
while(<IN>) {
chomp;
($userP, $group) = (split /:/)[0,3];
$grps{$group}++;
$sql->execute($userP)
or warn "Can't execute select " . $sql->errstr;
$userD = $sql->fetchrow_array();
if($userD eq "") {
print OUT "UserP:$userP - UserD:$userD\n";
}
$sql->finish;
}
close(OUT);
close(IN);
</snip>
Thanks,
--
Rob