On Thu, 2007-08-16 at 10:38 +0100, Gary Stainburn wrote:
> Hi
>
> Firstly, for an excelent general perl list, try [EMAIL PROTECTED] It's not
> just for beginners.
Ah.. Cool.. I'll subscribe there.
>
> Secondly, it looks like you're trying to access a field that isn't defined,
> possibly by running off the end of the row.
>
> I've re-written (but not tested) the routine slightly more perlified.
>
> See what you think.
>
> while (my @row = $sth->fetchrow_array )
> {
> foreach my $field (shift @row) {
> if (! defined ($field) || (length($field) == 0))
> {
> # don't know why you do this cos
> # you're printing nothing here
> print $field;
> } else {
> print "\"$field\"";
> }
> if (@row) # fields left, stick in a comma
> {
> print ",";
> }
> }
> print ("\n");
> }
Thanks for the solution, however it doesn't really run. Not sure why.
There's a supposed missing brace/curly brace somewhere but I can't find
it yet. Your solution is more elegent. I will definitely try to figure
out where the error is..