in reply to Silencing the grumbling from DBD::ODBC

Looks like you are trying to evaluate the query result:
eval { $ref = $dbh_g->selectcol_arrayref($sql) };
so better try
eval("$ref = $dbh_g->selectcol_arrayref($sql)")
and the eval will catch the error :-) if the query fails
Have a nice day
All decision is left to your taste

Replies are listed 'Best First'.
RE: RE: Silencing the grumbling from DBD::ODBC
by Fastolfe (Vicar) on Sep 28, 2000 at 19:27 UTC
    I think either version of eval is equivalent as far as error trapping is concerned.

    Regardless, the latter version would fail, since $sql and $dbh_g would be interpolated as the string were parsed, prior to sending the resulting argument to eval. The result would be bad Perl syntax and execution would fail. You could just put it in single-quotes instead, which would work, but you're still incurring the compilation overhead at run-time instead of putting it into a block, which is compiled along with the rest of the script.