Please forgive the stupidity of this question but I'm stumped and need
to get this program finished. I am currently working on a program that
will select information from two databases. The program puts both into
hashes and compares the two lists.

If it finds information in table one but not in table two it is to
perform certain commands to place that user in table two, and vice
versa. I know how to implement this part, however here is my problem. 

Please bear in mind just as a test I am doing print statements.

The Problem.

The two tables are not the same length however my first if statements
will end the process after it reaches the end of the table.

My second and third if's will find the output of the first difference
and then stop. What I need to know is what type of for loop do I need to
continue this program from the beginning instant of the list length on
to the next instances the tell if the user is in the list or not.

The for loops I have now merely prints out a number 3 instead of the
actual username lists. My questions is am I on the right track here with
the for loops? Am I printing the wrong variable? If not does anyone have
any better suggestions?

Thank-You,

---------------------------------------- Program Below


#!/usr/local/bin/perl 

use Sybase::DBlib;
use DBI;

# ClienTele Sybase Information

Database & User Name Information Omitted

$i = 0;
$j = 0;

$ctelnew = new Sybase::DBlib $sql_user,$sql_password,$sql_server;
$ctelnew->dbuse ('clientele');
$ctelnew->dbcmd("select EmailName from EmailAccount where AccountNumber
= '012616' "); $ctelnew->dbsqlexec; while ($ctelnew->dbresults !=
NO_MORE_RESULTS) {
  while(@dat = $ctelnew->dbnextrow) {
    push @emailname,$dat[0];
  }
}

$dbh = DBI->connect("DBI:mysql:database=$dbase;$dbhost", $dbuser,$dbpw);
$sth = $dbh->prepare("select address from notify_list"); $sth->execute
|| print "Can't execute statement: $DBI::errstr\n"; while (@sub =
$sth->fetchrow_array) {
  $subname = $sub[0];
  ($user,$ext) = split(/@/, $subname);
  push @sub_name,$user;
}
close(SUB);

while ($i <= $#emailname && $j <= $#sub_name) {
  if ($emailname[$i] eq $sub_name[$j]) {
    $i++;
    $j++;
  } elsif ($emailname[$i] lt $sub_name[$j]) {
    foreach ($i=$i;$i <= $#emailname;$i++) {
      print "$i\n";
    }
    $i++;
  } else {
    foreach ($j=$j;$j <= $#sub_name;$j++) {
      print "$j\n";
    }
    $j++;
  }
}

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to