S
samasama
Hi, noob here...
I'm trying to read a row containing usernames and see if those
usernames are in an already created hash...
------- Code -------
my %lusers;
sysopen( LIST0, "list.txt", O_RDONLY );
#|| die "Can't open original list!";
while (<LIST0>) {
my @fields = split(/\s{2}/, $_);
$lusers{$fields[0]} = $fields[1];
}
my $dbh = open_db('ro') || die "Could not open db: $!\n";
my $sql = qq{ SELECT username
FROM dialup
};
my $sth0 = $dbh->prepare($sql) || die "DBH Preparing: ",
$dbh->errstr;
$sth0->execute;
while ( my $row = $sth0->fetchrow_hashref ) {
foreach my $keys (keys %lusers) {
if ($row->{'username'} ne $keys) {
print "$keys not in db\n";
}
}
last;
}
----------------
I know I'm going wrong on my if statement there, but I'm not sure what
I should be comparing exactly...
Any help is vastly appreciated.
Thanks
I'm trying to read a row containing usernames and see if those
usernames are in an already created hash...
------- Code -------
my %lusers;
sysopen( LIST0, "list.txt", O_RDONLY );
#|| die "Can't open original list!";
while (<LIST0>) {
my @fields = split(/\s{2}/, $_);
$lusers{$fields[0]} = $fields[1];
}
my $dbh = open_db('ro') || die "Could not open db: $!\n";
my $sql = qq{ SELECT username
FROM dialup
};
my $sth0 = $dbh->prepare($sql) || die "DBH Preparing: ",
$dbh->errstr;
$sth0->execute;
while ( my $row = $sth0->fetchrow_hashref ) {
foreach my $keys (keys %lusers) {
if ($row->{'username'} ne $keys) {
print "$keys not in db\n";
}
}
last;
}
----------------
I know I'm going wrong on my if statement there, but I'm not sure what
I should be comparing exactly...
Any help is vastly appreciated.
Thanks