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 ??

I'm including the whole script below..

Thanks in advance,

Jerry
#! /usr/bin/perl  -w
#@ _COMMENT_
# dump_members.pl - dump Historical League's membership list
#@ _COMMENT_

#@ _USE_
use strict;
use DBI;
#@ _USE_

#@ _VARDECL_
my $dsn = "DBI:mysql:sampdb:incc-test"; # data source name
my $user_name = "jerry"; # user name
my $password = "secret"; # password
#@ _VARDECL_


#@ _CONNECT_
# connect to database
my $dbh = DBI->connect ($dsn, $user_name, $password,
{ RaiseError => 1, PrintError => 0 });
#@ _CONNECT_


#@ _ISSUE_QUERY_
# issue query
my $sth = $dbh->prepare ("SELECT last_name, first_name, suffix, email,"
. "street, city, state, zip, phone FROM member ORDER BY last_name");
$sth->execute ();
#@ _ISSUE_QUERY_


#@ _FETCH_LOOP_
# read results of query, then clean up
#
while (my @ary = $sth->fetchrow_array ())
{
        print join ("\t",  @ary), "\n";
}

$sth->finish ();
#@ _FETCH_LOOP_

#@ _TERMINATE_
$dbh->disconnect ();
exit (0);
#@ _TERMINATE_


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



Reply via email to