jason corbett wrote:
> Here is what I am doing. I shortend the sub, using local variables,
> and simplifying the whole thing to just print to screen. I use your
> loop once I collect the records into the @record variable and join
> them with ","...   
> 
> Still to no avail, that menacing warning stays.
> 
> Thanks.
> 
> 
> my $sql=qq( select * from bill where rownum <100
> );

Explicitly name the columns you want to select on. It could end up
saving you a bunch of headaches in the long run. Also, go into the MySQL
CLI and type your command in, just to make sure you're getting back what
you want... I'm willing to bet that you're getting back NULL values in
one or more of your columns, which may be causing problems in the join
statement.

> 
> my $sth=$dbh->prepare($sql);
> 
> $sth->execute();
> 
> my $recordlist;
> my $dayreport =
> "/cygdrive/c/cygwin/my_Perl/basic_script/testfile.txt"; 
> 
> my @record;
> 
> 
> 
>  while( @record= $sth->fetchrow_array())
> 
>         {
> 
> 

For debugging, try adding in the following lines:

use Data::Dumper;
print "# of columns: " . @record . "\n";
print "[EMAIL PROTECTED]:\n" . Dumper([EMAIL PROTECTED]) . "\n";

You may find that your whole array is, in fact, populated with NULL
values...

>  $recordlist=join(",",@record); #This statement is causing the problem
> 
> for ( my $i = 0; $i < $#record; $i++)
> {
>       print "$record[$i],";
> }
> 
> print "$record[$#record]\n";
> 
> 
> 
>   }    exit;
> 
> $dbh->disconnect;

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to