in reply to how do get value of mysql column

To get the values of a single column for all rows matching a query do:
my $aryref = $dbh->selectcol_arrayref( $sql,{},@binds );
To get the value of a single column for a single row matching a query do:
my($value) = $dbh->selectrow_array( $sql,{},@binds );
In both cases, the SQL query should specifiy only a single column in the SELEC list, e.g. SELECT foo FROM ...