in reply to cannot retrieve value from select statement

The steps in using a statement hanlde are prepare, exectue, and fetch, not do and fetch:
my $sth = $dbh->prepare( $sql ); $sth->execute; my @array = $sth->fetchrow_array;
Note also that fetchrow_array returns, as it says, an array so the return should be assigned to an array, not a scalar. Also note that this will only fetch one row. If you want more rows you need to do the fetchrow_array() inside a loop.