>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, June 13, 2001 6:29 PM
>To: [EMAIL PROTECTED]
>Subject: Strange Warning
>
>
>Hi,
>
>I get a strange warning in the following part of my code:
>
>  my @zeile;
>  while (@zeile = $sth->fetchrow_array()) {
>    print WL "@zeile\n";
>  }
>
>For every Row I get:
>
>       Use of uninitialized value at ./wertelisten.pl line 23
>
>How can it be undefined? On the other hand the program works find, so I

Pretty simple really. One of the fields in every row is a null value. You
probably want to replace this with a blank string for printing purposes.

another tip. Instead of:
>  my @zeile;
>  while (@zeile = $sth->fetchrow_array()) {

You probably want:
  while (my @zeile = $sth->fetchrow_array()) {

Nothing to do with this, but more of a good habit to get into unless you
specifically want something else.

--Neil

>could just remove the -w to ignore the warnings, but I do not like this
>solution very much, since -w really helps me a lot...
>
>Peter
>
>P.S: with "print WL $zeile[0];" there are no warnings...
>
>P.P.S: For those of you who want to see the complete code:
>
>#!/usr/local/bin/perl -w
>
>use DBI;
>use strict;
>
>$| = 1;
>$ENV{'NLS_DATE_FORMAT'} = "DD-MM-YYYY";
>
>my @wertelisten = qw{ t_tarife t_besicherungsarten t_produktklassen };
>
>my $dbh = 
>  DBI->connect("DBI:Oracle:XXX","xxx","xyz")
>  or die ("Cannot connect to Oracle Database: $DBI::errstr\n");
>
>for my $wl ( @wertelisten ) {
>  open WL, ">out/$wl";
>  my $sth = $dbh->prepare(qq{
>    select * from $wl
>  }) or die "Cannot prepare statement\n";
>  $sth->execute or die "Cannot execute statement";
>  my @zeile;
>  while (@zeile = $sth->fetchrow_array()) {
>    print WL "@zeile\n";
>  }
>  $sth->finish;
>  close WL
>}
>
>$dbh->disconnect() or warn "Disconnection failed: $DBI::errstr\n";
>

__________________________________________________________________________
Please Note :
Only  the intended recipient is authorised to access or use this e-mail.  If
you are not the intended recipient,
please delete this e-mail and notify the sender immediately.   The contents
of this e-mail are the writer's 
opinion and are not necessarily endorsed by the Gunz Companies unless
expressly stated.

We use virus scanning software but exclude all liability for viruses or
similar in any attachment.


Reply via email to