in reply to Just another DBI question.

You are very close on this one - I think you will find that it is the selectcol_arrayref method detailed in the DBI documentation that you require. eg.

my $arrayref = $dbh->selectcol_arrayref(qq/ SELECT $myColumn FROM $myTable /); my @array = @{$arrayref};

Note that the returned data structure is an array reference rather than an array, hence the second line to dereference the data structure. If you are not familiar with this terminology, you can read up on references in perlref.

 

perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'

Replies are listed 'Best First'.
Re: Re: Just another DBI question.
by xtype (Deacon) on Jan 19, 2002 at 03:52 UTC
    Ah, yes, this is exactly what I had wanted.
    Thank you.
    I guess that I missed reading:
    In a scalar context, fetchrow_array returns the value of the first fie +ld. An undef is returned if there are no more rows or if an error occ +urred. Since that undef can't be distinguished from an undef returned + because the first field value was NULL, you should exercise some cau +tion if you use fetchrow_array in a scalar context.
    from the DBI perldoc
    Also, I suppose that I could be using the other select*_*() DBI functions instead of the extra prepare and execute calls.

    -xtype