Not very sure, but it happened with me once, ir is because some columns have
null value
and so this field in the array was not set and you are trying to print.
Regards,
Mahdi,
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 13, 2001 10:29 AM
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
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";