On Wednesday, Oct 22, 2003, at 14:21 Europe/Brussels, Harald Fuchs wrote:


In article <[EMAIL PROTECTED]>,
Jerry Rocteur <[EMAIL PROTECTED]> writes:

Hi,
I'm reading MySQL by Paul DuBois

When I run dump_members.pl I get:

Use of uninitialized value in join or string at ./dump_members.pl line
35.


Line 35 is the print line before.

while (my @ary = $sth->fetchrow_array ())
{
         print join ("\t",  @ary), "\n";
}

I just can't see which value is not initialized...

As I'd like to use the script for my own use and I would prefer using
perl -w than not using it what do I change in the script in order NOT
to get the error ??

Probably one of the columns of the returned row is NULL which gets translated to undef. Try this:

while (my @ary = $sth->fetchrow_array ()) {
  @ary = map { defined $_ ? $_ : "NULL" } @ary;
  print join ("\t",  @ary), "\n";
}


Perfect ... Thanks very much.. That works like a charm!


Now, Paul, perhaps the script should be like this instead of the one your provide with sampdb ???

Thanks guys,

Jerry



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to