Still banging my head into a wall...  Now I am getting NULLs
inserted as expected into the database, but I am getting errors on the
compare.

    my @old = $test->fetchrow_array ();
    foreach $n (0..20) {
      chomp($file_val = $data[$n]);
      $file_val =~ s/\s*$//;
      #chomp($db_val = $old[$n+1]);
      #if ($file_val eq "") {
      #  print "NULL found in $n value. $file_val\n";
      #  $file_val = 0;
      #}
      # print "Comparing $file_val to $db_val. \n";  # Testing line
      if (defined $old[$n+1]) {
        if ($file_val eq $$old[$n+1]) {
          $update = 1;
        } else {
          $update = 0;
          # print "Comparing $file_val to $db_val. \n";  # Testing line
          last;
        }
      }
    }

        Here are the errors.

Name "main::old" used only once: possible typo at ./host_tbl_update2.pl
line 65.
Use of uninitialized value in string eq at ./host_tbl_update2.pl line
65, <CSV> line 1.
Use of uninitialized value in string eq at ./host_tbl_update2.pl line
65, <CSV> line 2.
DBD::mysql::st execute failed: Column 'Vantive_HW' cannot be null at
./host_tbl_update2.pl line 80, <CSV> line 2.

        I am pretty much confused by all of this.  That is until I was
typing this up and noticed I had typo'd an extra '$' on the comparison
line.  Maybe now all will be good.  Thanks again.



Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



-----Original Message-----
From: Jeff Zucker [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 16, 2005 11:49 AM
Cc: dbi-users@perl.org
Subject: Re: NULLs in Text::CSV_XS and DBD::CSV


Jeff Zucker wrote:

> 1,,2
> 1,"",2
>
In case I was unclear: the first is three fields with the second field 
NULL, the second is three fields with the second field an empty string.

-- 
Jeff

Reply via email to